Quantcast
Channel: CNode:Node.js专业中文社区
Viewing all articles
Browse latest Browse all 14821

这样配置Nginx,为什么一直是404呢?谢谢

$
0
0

下面是我的Nginx配置,我目前使用 http://wqjp.lefe.wang:4001/api/store/get可以请求到数据,但是我使用 http://wqjp.lefe.wang/api/store/get却报404错误。Https同样的错误。谢谢了。其实我想做的就是接口 【 http://wqjp.lefe.wang:4001/api/store/get】可以不使用端口就可以访问【 http://wqjp.lefe.wang:4001/api/store/get】。

#user  nobody;
worker_processes 1;
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;
    server {
       listen       80;
       server_name  wqjp.lefe.wang;
       location / {
           root   /home/ubuntu/nodeserver/WJCar_node/WJCar;
           index  app.js;
           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:4001;
           proxy_redirect off;
        }
   }

    # HTTPS server
    server {
        listen 443;
        server_name https://wqjp.lefe.wang;
        ssl on;
        ssl_certificate /home/ubuntu/nodeserver/WJCar_node/WJCar/res/1_wqjp.lefe.wang_bundle.crt;
        ssl_certificate_key /home/ubuntu/nodeserver/WJCar_node/WJCar/res/2_wqjp.lefe.wang.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;
        location / {
           root   /home/ubuntu/nodeserver/WJCar_node/WJCar;
           index  app.js;
           proxy_redirect off;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_pass https:118.89.23.181:4000;
        }
    }
}

Viewing all articles
Browse latest Browse all 14821

Trending Articles