I have default Listen 80
in httpd.conf. Sometimes I need my own webapp to run on that port so I run it with sudo
. So, first I need to change Apache port to something else. What I am looking for is a quick one click action to switch in forth and back.
Please advise.
You can't.
In order to change the port(s) or address(es) the web server is listening on you must change the web server configuration and restart the web server.
I think your best options are:
Using
mod_proxy
to pass your app through ApacheHave your app listen on some other port and configure mod_proxy appropriately
Have both Apache and your app listen on different ports and use a third application to listen on port 80 and forward the requests to the appropriate service.
Basically writing your own socket-bouncing proxy.
Writing that socket-bouncing proxy (or configuration of mod_proxy) is left as an exercise for the reader - mainly because I don't know your internal requirements.