Nginx配置文件如下:
仅加载honfronend时出现问题,但honbackend却不起作用:
前端配置
upstream honfronend {
# Nodejs app upstream
server 127.0.0.1:5000;
keepalive 64;
}
后端配置
upstream honbackend{
server 127.0.0.1:3000;
}
端口80上的服务器
server {
listen 80;
server_name www.honeygram.com;
root /var/apps/hgweb;
location / {
# Proxy_pass configuration
proxy_pass http://honfronend/;
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_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_max_temp_file_size 0;
proxy_redirect default;
}
}
server {
listen 81;
server_name api.honeygram.com;
server_tokens off;
root /var/apps/HGBackend;
location /api/ {
proxy_pass http://honbackend;
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_set_header X-Ssl on;
proxy_redirect default;
}
}
hgbackend出现以下错误
404 Not Found
nginx
那我应该怎么办?