개요
hello.html과 allow 디렉토리만 허용하고, 나머지 요청은 301 리다이렉트하도록 nginx.conf를 수정
http {
....
server {
listen 80;
server_name localhost;
# deny everything that doesn't match another location
location / {
#deny all;
return 301 https://coupang.com;
}
# allow access #1
location /hello.html { }
location /allow/ { }
....
# allow access #2
location ~ ^/hello.html|/allow/ { }
}
}
참고
- https://whatisthenext.tistory.com/123
- https://extrememanual.net/1854
- https://baejino.com/linux/nginx-setting
- https://serverfault.com/questions/222854/set-nginx-conf-to-deny-all-connections-except-to-certain-files-or-directories
Notice
