NginX 특정 파일/폴더만 허용

개요

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/ { }
	}
}

참고

댓글 남기기