解決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即可。