![](/img/trans.png)
[英]502 Bad Gateway on Google Compute Engine, Nginx, and Meteor
[英]502 Bad Gateway - Meteor and nginx on Ubuntu 16.04.2 LTS
我在使用Nginx的Ubuntu 16.04.2 LTS服务器上安装Meteor / NodeJS网站时遇到问题。
我想按照下面的文章如何使用Nginx(数字海洋)在Ubuntu 14.04上部署Meteor.js应用程序,因为它不是最新版本我也会看到这个www.medium.com/@jaaaco/run-meteor-应用作为一种服务上,Ubuntu的c4aa1153408a#.bn9q49h1w
systemd:
[Service] ExecStart=/usr/bin/node /home/dezeiraud/bundle/main.js Restart=always StandardOutput=syslog StandardError=syslog SyslogIdentifier=dezeiraud User=dezeiraud Group=dezeiraud Environment=NODE_ENV=production Environment=PWD=/home/dezeiraud Environment=PORT=8080 Environment=HTTP_FORWARDED_COUNT=1 Environment=ROOT_URL=http://dezeiraud.com Environment='METEOR_SETTINGS={"someSetting": "someValue"}' [Install] WantedBy=multi-user.target
它看起来效果很好(见下图)。
Ngnix:
server_tokens off; # for security-by-obscurity: stop displaying nginx version # we're in the http context here map $http_upgrade $connection_upgrade { default upgrade; '' close; } # the Meteor / Node.js app server server { listen 80; server_name dezeiraud.com; access_log /etc/nginx/logs/dezeiraud.access; error_log /etc/nginx/logs/dezeiraud.error error; location / { proxy_pass http://127.0.0.1:8080; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_http_version 1.1; # WebSocket proxying proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; add_header Cache-Control no-cache; } }
这里是nginx的配置。 错误文件包含以下文本:
失败(111:拒绝连接)
我正在寻找一个解决方案,这将是几个小时,而我在互联网上的研究并不是决定性的......我猜这个错误是荒谬的,但我找不到它。
感谢您的时间。 最好的祝福。 (对不起,我的英语不好)
我有一个类似的问题,它与流星运行的端口有关,所以我将端口从8080更改为3000(默认情况下3000端口流星运行我认为)
在systemmd文件中
Environment=PORT=3000
并在nginx文件中
location / {
proxy_pass http://127.0.0.1:3000;
# ........ continue with rest
# ........ continue with rest
}
您可以使用此命令查找端口8080中是否正在运行任何内容
sudo netstat -peant | grep ":8080 "
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.