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
Take 3 consecutive days as an example, using the ...
1. Edit the docker.service file vi /usr/lib/syste...
The operating environment of this tutorial: Windo...
What is the main function of Docker? At present, ...
Chapter 1 Source Code Installation The installati...
1. After entering the container cat /etc/hosts It...
Table of contents Introduction Install 1. Create ...
mysql create table sql statement Common SQL state...
Nginx cross-domain configuration does not take ef...
This article shares the specific code of JavaScri...
The JD carousel was implemented using pure HTML a...
Table of contents Water wave effect Let's see...
Say it in advance Nodejs reads the database as an...
In Dockerfile, run, cmd, and entrypoint can all b...
MySQL backup Cold backup:停止服務進行備份,即停止數據庫的寫入Hot ba...