Home  >  Q&A  >  body text

Configuration problem that nginx cannot access html on the server

There is index.html under /www/cms/production/current/dist on the server

nginx configuration:

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;
  }
}

Why only a welcome to nginx page is displayed through xxx.xxx.com, but my index.html cannot be displayed?

巴扎黑巴扎黑2677 days ago926

reply all(1)I'll reply

  • 習慣沉默

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

    The port was written wrong, it has been solved

    reply
    0
  • Cancelreply