0
我有/var/www/vhosts/example.com/app/public和/var/www/vhosts/example.com/app/static中的靜態文件,我希望nginx檢入。 IE瀏覽器。 domain.com/photo.png可以位於公共目錄或靜態目錄中。Nginx的try_files多個目錄
這是我的nginx配置,但與try_files一樣,我的整個網站給出了nginx 500內部服務器錯誤。沒有這一行,我的nodejs表示應用程序加載正常,但是當然沒有靜態文件可以訪問。我有什麼錯誤?
location ~/{
root /var/www/vhosts/domain.com/app;
try_files /public/$uri /static/$uri;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:3000;
}
你打算用這個既反向代理和服務中的文件? 另外,如果你在linux上,請粘貼'nginx -t'的輸出 – Yadvendar
是的。輸出nginx -t: nginx:配置文件/etc/nginx/nginx.conf語法正常 nginx:配置文件/etc/nginx/nginx.conf測試成功 –