In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to achieve the coexistence of Nginx and Apache under the Linux server", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn how to achieve the coexistence of Nginx and Apache under the Linux server "this article.
Two programs cannot listen on the same port at the same time. So find another way to solve the problem that some websites run under nginx and some websites coexist under Apache under the same server.
The solution is as follows:
Use nginx as a proxy server and web server, nginx listens on port 80, Apache listens on ports other than 80, and I temporarily use port 8080.
Solution:
Once the environment of Linux is set up, Nginx and Apache are installed successively because the default port is: 80
The server port requested by the general customer defaults to 80, so Nginx is set as the static page port: 80 position Apache sets the port to: 8080 (modify Listen:8080 in the httpd.conf file)
Websites 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
ServerName www.one.ityangs.cnServerAlias www.one.ityangs.cn one.ityangs.cnDocumentRoot / www/oneDirectoryIndex index.php index.htmlOptions + Includes + FollowSymLinks-IndexesAllowOverride AllOrder Deny,AllowAllow from All
Websites 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 www/two; location 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;}} these are all the contents of this article entitled "how to achieve the coexistence of Nginx and Apache under Linux Server". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.