
我有一個非常基本的 Nginx 配置,但我似乎無法開始工作。我試圖讓 Nginx 為我的節點應用程式提供伺服器/
,然後我有一條/colors
似乎不想工作的路由。是的,我知道我的設定檔有,/colors/
但這也不起作用。即使我輸入確切的 html 檔案名稱/路徑,兩者都會返回 404 not found
我知道這個問題之前已經被回答過 1000 次了,但我嘗試了一切,但沒有任何效果
location / {
proxy_pass http:/<IP>:<PORT>;
include /etc/nginx/proxy_params;
}
location /colors/ {
root /var/www/colors;
}
編輯**
如果我改變它,以便顏色在/
那時完成,它可以工作,但不使用/colors
或/colors/
答案1
root /var/www;
透過設定我的伺服器區塊頂部的 ,然後設定以下位置區塊來使其工作。
location /colors/ {
autoindex on;
root /var/www;
}