0
Nginx設置爲將我的節點服務器9200代理到端口80,根設置爲服務mypath/to/node_build
。我想上傳一些靜態文件到/projects
。從位置/項目直接請求到不同的根,Nginx?
所以我做location /projects { root /mypath/to/static_projects}
但我得到一個404錯誤。
server {
listen 80;
root /var/www/example.io/public_html/dist;
index index.html index.htm;
# Make site accessible from http://example.io
server_name example.io;
server_name app.example.io;
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1y;
}
location/{
proxy_pass http://127.0.0.1:9200;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location ^~ /blog {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:9200;
proxy_redirect off;
}
location /projects {
root /var/www/example.io/public_html/projects;
}
gzip on;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/x-javascript;
gzip_vary on;
gzip_disable 「msie6″;
#error_page 404 /404.html;
}
哦沒關係,所以這是問題,呃。我會很快回到配置並回傳結果和檢查。 – 2015-04-05 05:16:39