Linux(CentOS 7)下安装配置nginx代理商多个tomcat实例和应使用

作者 : 开心源码 本文共1839个字,预计阅读时间需要5分钟 发布时间: 2022-05-11 共72人阅读

注:本文 nginx版本:1.12.2 Tomcat版本: 9.0.2

*yum安装

[root@izbp1di2a9vvogy93gw0onz local]# rpm -ivh https://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

[root@izbp1di2a9vvogy93gw0onz local]# yum install nginx

*启动

[root@izbp1di2a9vvogy93gw0onz local]# systemctl start nginx.service

启动报错:

Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.

● nginx.service – nginx – high performance web server

Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)

查看状态

[root@izbp1di2a9vvogy93gw0onz local]# systemctl status nginx.service

Active: failed (Result: exit-code) since Tue 2017-12-19 10:58:55 CST; 10s ago

Docs: http://nginx.org/en/docs/

Process: 26726 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)

Process: 26722 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)

Dec 19 10:58:52 izbp1di2a9vvogy93gw0onz nginx[26726]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

……

Dec 19 10:58:55 izbp1di2a9vvogy93gw0onz systemd[1]: nginx.service: control process exited, code=exited status=1

Dec 19 10:58:55 izbp1di2a9vvogy93gw0onz systemd[1]: Failed to start nginx – high performance web server.

Dec 19 10:58:55 izbp1di2a9vvogy93gw0onz systemd[1]: Unit nginx.service entered failed state.

Dec 19 10:58:55 izbp1di2a9vvogy93gw0onz systemd[1]: nginx.service failed.

能看到是bind to 0.0.0.0:80 fail——绑定80端口失败,

查看nginx错误日志(可可以要先改log文件权限)

[root@izbp1di2a9vvogy93gw0onz local]# /var/log/nginx/error.log

/var/log/nginx/error.log: line 1: syntax error near unexpected token ('

/var/log/nginx/error.log: line 1:2017/12/19 10:54:17 [emerg] 26705#26705: >>bind() to 0.0.0.0:80 failed (98: Address already in use)’

80端口早已被用,将占使用80端口的Tomcat关闭后启动成功

[root@izbp1di2a9vvogy93gw0onz local]# systemctl start nginx.service

可使用[root@izbp1di2a9vvogy93gw0onz local]# rpm -ql nginx | grep nginx

查看安装软件(nginx)的位置信息

Linux(CentOS 7)下安装配置nginx代理商多个tomcat实例和应使用

说明
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » Linux(CentOS 7)下安装配置nginx代理商多个tomcat实例和应使用

发表回复