This article describes how to implement coexistence of Nginx and Apache on Linux server. Share with you for your reference, the details are as follows: There cannot be two programs listening on the same port at the same time. So we changed our thinking and solved the problem of some websites running under nginx and some websites running under Apache coexisting on the same server. Solution:
Solution:
Website under Apache: 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 httpd.conf <virtualhost *:8080> ServerName www.one.ityangs.cn ServerAlias www.one.ityangs.cn one.ityangs.cn DocumentRoot /www/one DirectoryIndex index.php index.html <Directory /www/one> Options +Includes +FollowSymLinks -Indexes AllowOverride All Order Deny,Allow Allow from All </Directory> </virtualhost> Website under Nginx: Add in nginx.conf server { listen 80; server_name two.ityangs.cn www.two.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_page 404 /var/www/html/404.html; } location ~ \.php(.*)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } } I hope this article will help you maintain your Linux server. You may also be interested in:
|
<<: How to make your own native JavaScript router
>>: MySQL SQL statement analysis and query optimization detailed explanation
When developing mobile apps, you often encounter ...
Without further ado, I will post the code for you...
Find the containerID of tomcat and enter the toma...
MySQL service 8.0.14 installation (general), for ...
<br />Reading is a very important part of th...
After the application is containerized, when the ...
1. To develop web responsively, the page must ada...
Table of contents 1. Self-enumerable properties 2...
MySQL multi-table query (Cartesian product princi...
Table of contents Get the time in the past week G...
Table of contents Normal paging query How to opti...
This article example shares the specific code of ...
Table of contents background: Nginx smooth upgrad...
When writing the HTTP module of nginx, it is nece...
Use JS to complete a simple calculator for your r...