Allow Virtual-Server to Restart Apache

7 posts / 0 new
Last post
#1 Sun, 06/12/2011 - 06:30
alexp999

Allow Virtual-Server to Restart Apache

I have searched for an answer and couldn't find one, but I'm wondering, is it possible for users/virtual-servers, to restart apache?

Or restart their instance of apache? For example, if I change a php.ini file as a virtual-server/user login, I then have to log out and back in as root to restart apache for the changes to take effect.

So basically, is there a way for a user to restart apache?

Sun, 06/12/2011 - 06:40
Locutus

First: A regular user should never be able to manipulate system service, including restarting them.

In this case: there is no "their instance of Apache"; there is only one Apache process (with possible child processes) shared for all virtual servers.

The thing that is per-server is the PHP-CGI process, in case you're using FCGId as PHP calling method, as opposed to mod_php.

So, to apply changes to php.ini without root-restarting Apache, you for one need to be using FCGId, since only then does every virtual server have its own copy of the ini file and its own PHP process. After making the changes, it should then suffice to kill the PHP process that is running under the virtual server's administrative username. Use ps aux | grep php5-cgi to list all those PHP processes. The first column in the output should be the username.

Sun, 06/12/2011 - 08:22
alexp999

I am running php as FCGId, thats why I thought it may be possible to just restart or end that users apache process.

Is there a way to just end/restart apache processes running under certain userids?

Sun, 06/12/2011 - 09:00
Locutus

As I said, there are no "Apache processes running under certain user IDs". Apache has one process (with possible children) for all users.

You can, as I explained, kill the FCGId process which then gets auto-restarted when required.

Mon, 06/13/2011 - 03:28
ronald
ronald's picture

When you enabled the apache module for clients in the server template,
then the client can go to:

Virtualmin - Services - Configure Website
In the right pane, top right, there is a link: Apply changes or go to

Webmin - Servers - Apache webserver and Apply Changes.

Mon, 06/13/2011 - 05:38
alexp999

@ronald.

Just what I was looking for, this worked out perfect.

Thank you!

Mon, 06/13/2011 - 06:44
Locutus

Yeah, that should work. Just make sure Apache does a gracelful restart then, otherwise your web server will be down for a few seconds for all users, including breaking of existing connections (in case some web service uses persistent connections).

Topic locked