关于处理:Job for nginx.service failed because the control process exited with error code.……问题

处理:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.(端口号被占用)问题

      • 解决方案:
        • 一.更改Apache默认端口号
          • 1.yum安装后,apache配置文件:
        • 二.更改Nginx默认端口号
          • 1.Nginx默认文件配置路径:
          • 2.将server里面的listen 80;改成另一个端口号保存退出即可。

    由于Nginx的默认端口为80,如果安装了Apache(默认端口:80),与之相冲突,所以无法正常启动

解决方案:

一.更改Apache默认端口号

1.yum安装后,apache配置文件:
/etc/httpd/conf/httpd.conf

找到apache目录下的 httpd.conf, 使用vim打开,找到 Listen=80 这一行,把80改成在此服务器上没有用到的端口号,保存退出。

二.更改Nginx默认端口号

1.Nginx默认文件配置路径:
/etc/nginx/nginx.conf
2.将server里面的listen 80;改成另一个端口号保存退出即可。

接下来就是重启 nginx:

service nginx reload

但是你会发现 nginx 访问不了,那是因为 81 端口没开放,

你可能感兴趣的:(CentOS)