best way to stop Apache on port 80 so mod_wsgi-express keeps running?

245 views
Skip to first unread message

Anupam

unread,
Jul 19, 2017, 1:22:28 AM7/19/17
to modwsgi
I am using mod_wsgi-express (on port 8000) behind Nginx (port 80). 

Everything ran fine but today I saw Nginx couldnt start up because Apache started up and occupied port 80. I remembered I never asked Apache not to do that (but wonder why this never occurred earlier because I have restarted the VM many times in the past). 

My question is what's the best way to tell Apache not to start up at all? I think just changing the listening port is not a good idea because I wont be using that server anyways (since mod_wsgi-express is its own separate instance of Apache, as I now understand it). Also I guess doing something like sudo systemctl disable apache2 may not work since mod_wsgi-express needs Apache?. Another option I read in the forums is sudo update-rc.d apache2 remove.

Happy to hear thoughts. I am on Debian.

thanks
Anupam


Graham Dumpleton

unread,
Jul 19, 2017, 1:27:09 AM7/19/17
to mod...@googlegroups.com
On 19 Jul 2017, at 3:22 PM, Anupam <anupa...@gmail.com> wrote:

I am using mod_wsgi-express (on port 8000) behind Nginx (port 80). 

Everything ran fine but today I saw Nginx couldnt start up because Apache started up and occupied port 80. I remembered I never asked Apache not to do that (but wonder why this never occurred earlier because I have restarted the VM many times in the past). 

Purely luck probably. The nginx server was probably quicker to start in most cases and got port 80 first. The Apache instance wouldn't be able to get it and would have gone into an error state.

My question is what's the best way to tell Apache not to start up at all? I think just changing the listening port is not a good idea because I wont be using that server anyways (since mod_wsgi-express is its own separate instance of Apache, as I now understand it). Also I guess doing something like sudo systemctl disable apache2 may not work since mod_wsgi-express needs Apache?. Another option I read in the forums is sudo update-rc.d apache2 remove.

Running:

    sudo systemctl disable apache2 

should be fine and enough to stop it running.

When using mod_wsgi-express you aren't relying on the existing Apache instance for the system to be running, only that the Apache packages are installed. That is, is uses the same Apache binary, include files, libraries and modules, but not the same Apache configuration. So unless you use the system Apache for some other reason, you should disable it in systemd so it doesn't start. Just do not uninstall the Apache using apt-get.

Graham

Anupam

unread,
Jul 19, 2017, 5:35:11 AM7/19/17
to modwsgi
Thanks for a quick and useful response, as always. Disabled it now and works well.
Reply all
Reply to author
Forward
0 new messages