配置多個站點404
我選擇了配置多個location。
location / { root /data/html/; index index.html index.html; } location /publicity { root /usr/local/nginx/hzcloud-timp-front/; index index.html index.htm; }
配置完以后訪問。http://xxxx/train 提示404
找了好久才搞明白, location如果一個特定的url 要使用別名,不能用root,alias指定的目錄是准確的,root是指定目錄的上級目錄,改動后即可以使用了
location /publicity { alias /usr/local/nginx/hzcloud-timp-front/; index index.html index.htm; }