Work needs, from the same port into the server-side shunt, to perform different port services. Use Apache's reverse proxy function to implement.
①"apache2ctl-m" See if the Proxy module (below ★) is loaded. If not loaded, perform "a2enmod proxy_http" load.
[Email protected]:/etc/apache2/sites-available# apache2ctl-mloaded modules:core_module (Static) So_module ( Static) Mpm_event_module (shared) negotiation_module (shared) proxy_module (shared) ★proxy_http_module (shared) ★r Ewrite_module (shared) setenvif_module (shared) status_module (shared)
②port 9596 httpd conf file with additional Reverproxy settings
As a prerequisite, ensure that the following files and folders exist
/var/wwwtest_9596/test/index.html
/var/wwwtest_9596/test/apachetest
<virtualhost *:9596 > ServerAdmin [ Email protected] documentroot /var/wwwtest_9596/ ####### #追加部分 ###### # # <ifmodule mod_proxy.c> #Reverse proxy <proxy * > Order Deny,allow Deny from all to ll </proxy> proxyrequests Off #proxy setting Proxypa SS /test/apachetest/http:// 127. 0.0.1:80/ proxypassreverse/test/apachetest/http:// 127.0.0.1:80/ </ifmodule> ####### #追加部分 ########</virtualhost>
③"service apache2 restart", restart the Apache service to allow the above proxy settings to take effect.
④ input the http://serverip:9596/test from the browser, at this point the service is performed under Port 9596.
⑤ input the http://serverip:9596/test/apachetest/from the browser, at this point the service is performed under Port 80. General 80 The default is to open the Apache test page.
In fact, Apache made a replacement http://serverip:9596/test/apachetest/-http://serverip:80/
In fact, if the parameters, it will automatically pass through. Http://serverip:9596/test/apachetest/?u=username&p=password-http://serverip:80/?u=username&p= Password
Apache's Reverse proxy setting