The same port cannot be monitored by two programs at the same time. So change your mind. Some websites run under Nginx under the same server, and some websites run under Apache coexistence. Solution Ideas:
Nginx as a proxy server and Web server use, nginx monitoring 80 port, Apache listening to the port except 80, I temporarily use 8080 port.
Solution:
- In Linux once built environment has installed nginx and Apache because the default port is: 80
- The server port of the general customer request defaults to 80 so nginx as a static page port setting: 80; Apache set Port to: 8080 (Modify listen:8080 in httpd.conf file)
- Apache under the website:
Add in nginx.conf
server {listen 80; server_name Www.one.ityangs . CN one.ityangs.cn;location /{proxy_pass http://127.0.0.1:8080 ; Proxy_redirect off; Proxy_set_header Host $host; Proxy_set_header x-Real-ip $remote _addr; Proxy_set_header X -forwarded-for $proxy _add _x_forwarded_for; } }
Add in nginx.conf
server {Listen80; server_name. ityangs. CN www. the. ityangs. cn; Root/www/two; Location/{Index Index. HTML Index. htm index. php; if (!-e $request _filename) {rewrite ^ (. *) $/index. php?s=$1 last;Break; } error_page404/var/www/html/404.html; } location ~ \. PHP (. *) $ {Fastcgi_pass127.0.0.1: 9000.php) (/?. +) $; Fastcgi_param path_info $fastcgi _path_info
actual configuration:
Apache configuration file, httpd.conf configuration
nginx configuration file, nginx.conf configuration
Apache web site, using Nginx for reverse proxy (1 IP binding multiple domain names, corresponding to multiple websites) solution