我一直在尝试使用Ubuntu 18.04实例从Amazon Web Services部署我的网站。我遵循了本文档中的所有步骤:https://medium.com/@rksmith369/how-to-deploy-mern-stack-app-on-aws-ec2-with-ssl-nginx-the-right-way-e76c1a8cd6c6。而不是查看我的项目,我收到502 Bad Gateway错误。我尝试修复此文件:/ etc / nginx / sites-available
server {
listen 80;
index index.html
root /var/www/facemusic;
location / {
proxy_pass http://172.31.93.58:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
我还键入了nginx -t来测试nginx服务器并发现以下错误:
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed
我已经在Google上搜索了几个小时,但仍然无法弄清。