Nginx实用配置

from: 这里

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		try_files $uri $uri/ =404;
	}
	location /test_vul_id_1000003 {
		alias /home/test_vul_id_1000003;
		autoindex on;
	}
	location /test_vul_id_1000003 {
		root /home;
		autoindex on;
	}

非以上配置访问404原因 #

	location /test_vul_id_1000003 {
		root /home/test_vul_id_1000003;
		autoindex on;
	}

如以上配置, nginx 配置文件会将 root 加上 以上的 localtion , 导致访问时实际定位是 /home/test_vul_id_1000003/test_vul_id_1000003 所以就 404

生效命令 #

nginx -t
nginx -s reload
service nginx restart