reactjs - 在 ubuntu vps 上启动 nginx 服务时出错

标签 reactjs ubuntu nginx

我是 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”时,我看到了这个:

nginx, error

ngnix, error

请 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/

相关文章:

javascript - ReactJS 给子组件添加回调函数

javascript - React 在 body 外渲染 d3 图表

ruby-on-rails - Rails 4 + react rails gem : Could not find generator 'react:install'

web-services - 如何在 Ubuntu 中部署 gSOAP Web 服务?

firefox - Headless 中的 Selenium FirefoxDriver 出现错误

wordpress - HTTP 到 HTTPS 重定向在 AWS ALB 上不起作用

nginx - 太多的 nginx 等待连接

reactjs - 从客户端访问Elasticsearch而不通过API服务器是否安全?

git - 使用 git Hook 的服务器部署不起作用

NGinx : How to test if a cookie is set or not without using 'if' ?