您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

linux服务器上同时运行tomcat + apache

2025/1/18 2:45:45发布13次查看
解决apache监听80端口与nginx冲突的问题!
1:安装tomcat + jdk,监听 8080端口
2,安装php运行环境和nginx;
3:修改nginx 配置文件
vi /etc/nginx/nginx.conf
include /etc/nginx/conf.d/*.conf; server { listen 80; server_name www.91zjr.com 91zjr.com; error_page 404 = http://www.91zjr.com/index.html; access_log /var/log/nginx/www.91zjr.com.access.log; location / { proxy_pass http://localhost:8080; proxy_redirect off; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $http_x_forwarded_for; } } server { listen 80; server_name bbs.91zjr.com; access_log /var/log/nginx/bbs.91zjr.com.access.log; proxy_set_header host $http_host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; location ~ \.php$ { proxy_pass http://127.0.0.1:88; } location / { try_files $uri @apache; } location @apache { proxy_pass http://127.0.0.1:88; } }
4:修改apache配置文件
vi /etc/httpd/conf/httpd.conf
listen 88namevirtualhost *:88 servername bbs.91zjr.com documentroot /web/apps/bbs errorlog logs/bbs.91zjr.com-error_log customlog logs/bbs.91zjr.com-access_log combineddeflatecompressionlevel 7addoutputfilterbytype deflate text/html text/plain text/xml application/x-httpd-phpaddoutputfilter deflate css js html htm gif jpg png bmp php options followsymlinks allowoverride all order allow,deny allow from all
5:重启nginx 和httpd即可。 以上就介绍了linux服务器上同时运行tomcat + apache,包括了nginx 配置方面的内容,希望对php教程有兴趣的朋友有所帮助。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product