Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Build a versatile server (tomcat,IIS,PHP uses port 80 to coexist)

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Set up an all-round server

This is a very common scenario, where programs developed in multiple languages are deployed on the same server, and each language is run in a different web container for various reasons, and services are provided through the 80 side, for example: .net programs, java programs and php programs are deployed on the same server, and web services are all provided through port 80. In this scenario, we can only build an all-around server.

Structure diagram:

General ideas:

Apache port is set to: 80

All IIS service ports are set to: 8081

All Tomcat service ports are set to: 8080

Use the apache reverse proxy function proxy to access local IIS (8081) and Tomcat (8080)

Install apache. Download httpd-2.4.23-x64-vc14-r3 on the official website, decompress the cmd and enter the bin directory, and execute the command:

Httpd.exe-k install-n apache

Installed as a Windows service with the name apache

Configure the apache service. For example, if apache is installed in D:\ application_software\ Apache, then:

Find the file D:\ application_software\ Apache\ conf\ httpd.conf, open it with notepad, find the item: Define SRVROOT, and change the value on the right to the absolute path (hard disk path)

Ensure that the following modules are loaded

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

Keep looking and find: Listene 80

If your port 80 is occupied (you can check it with the command netstat-a under cmd), change port 80 to something else, please search the frogchou personal website for a solution.

Modify the httpd-vhosts file under Apache24\ conf\ extra

For example:

ServerAdmin frogchou@126.com

ServerName iis.frogchou.com

DefaultLanguage zh-CN

AddDefaultCharset GB2312

ProxyPreserveHost On

ProxyRequests Off

ProxyPass / http://localhost:8081/

ProxyPa***everse / http://localhost:8081/

ErrorLog logs/iis.frogchou.com_error_log

ServerAdmin frogchou@126.com

ServerName tomcat.frogchou.com

DefaultLanguage zh-CN

AddDefaultCharset GB2312

ProxyPreserveHost On

ProxyRequests Off

ProxyPass / http://localhost:8080/

ProxyPa***everse / http://localhost:8080/

ErrorLog logs/tomcat.frogchou.com_error_log

It is important to note that ServerName, ProxyPass and ProxyPa***everse are configured

ServerName: the user accesses the server through that domain name.

ProxyPass: the path to the agent, which can be local or another server address

ProxyPa***everse: the address of the backend server, which is the same as above, which can prevent the backend server from bypassing the reverse proxy caused by HTTP redirection.

2. IIS: modify the port of all IIS applications to 8081.

Pay attention to the mapping of the firewall. If the firewall does not map port 8081, do not select any IP address when binding the domain name in the IIS, just select *, otherwise the firewall under the corresponding IP path will be mapped to port 8081.

3 、 Tomcat:

Modify the port of all Tomcat applications to 8080

Configure the virtual directory in Tomcat and bind the domain name to find server.xml in tomcat\ conf

Add:

Startup sequence recommendation: start apache first and then start IIS and Tomcat

Note: when starting apche,tomcat or IIS, there may be a problem that the port is occupied and cannot be started. Please refer to

The other ports of http://www.frogchou.com/?p=152 are the same.

For more information, please move to http://www.frogchou.com personal website.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report