首頁  >  問答  >  主體

伺服器上nginx無法存取html的設定問題

#伺服器上 /www/cms/production/current/dist 下有index.html

nginx配置:

server {
  listen 3002;
  root /www/cms/production/current/dist;
  index index.html;
  server_name xxx.xxx.com;

  location / {
    try_files $uri $uri/ /index.html;
  }

  location /api/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forward-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:3000/api;
    proxy_redirect off;
  }
}

為何透過xxx.xxx.com只顯示了一個welcome to nginx的頁面,顯示不了我的index.html呢?

巴扎黑巴扎黑2677 天前934

全部回覆(1)我來回復

  • 習慣沉默

    習慣沉默2017-06-20 10:09:52

    埠寫錯了,已解決

    回覆
    0
  • 取消回覆