首頁 >後端開發 >php教程 >linux伺服器上同時運行tomcat + apache

linux伺服器上同時運行tomcat + apache

WBOY
WBOY原創
2016-07-29 09:11:141183瀏覽

解決apache監聽80埠與nginx衝突的問題!

1:安裝tomcat + jdk,監聽8080埠

2,安裝php運作環境與nginx;

3:修改nginx 設定

4:修改apache設定檔


vi /etc/httpd/conf/httpd.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;
        }
    }
5:重啟nginx 和httpd即可。

以上就介紹了linux伺服器上同時運行tomcat + apache,包括了nginx 配置方面的內容,希望對PHP教程有興趣的朋友有所幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn