我是 vps 的初级用户,我有一个 reactJS 应用程序,我想用 nginx 将它部署在我的 ubuntu 18 vps 上。 我已遵循本教程的步骤 Deploying create-react-app with Nginx and Ubuntu
我已经检查了所有步骤,但是当我输入命令时
sudo service nginx start
系统显示的是我,下一条错误信息:
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
当我输入“journalctl -xe”时,我看到了这个:
请 friend 们帮帮我
最佳答案
在错误“无法启动 nginx”之前查看日志文件中的消息
您会看到问题的原因。 bind() 到 0.0.0.0:80 失败(98:地址已被使用)
看起来您的 vps 服务器上的端口 80 已被某些应用程序占用。 用于 HTTP 服务的端口 80。
所以很可能您已经运行了 Apache HTTP 服务器或其他服务器。
使用此命令查看哪个应用程序使用它
sudo netstat -tulpn | grep ":80"
如果你看到 apache
tcp6 0 0 :::80 :::* LISTEN 349/apache2
然后你就可以停止apache了
# apache service name also can be httpd (use right command)
# sudo service httpd stop
sudo service apache stop
并运行 nginx
sudo service nginx start
但是您应该确定您没有将 apache 用于其他网站。
关于reactjs - 在 ubuntu vps 上启动 nginx 服务时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54559922/