Author |
|
Materix
Joined: 30 Aug 2012 Posts: 42
|
Posted: Wed 05 Jun '24 10:47 Post subject: Restart service after adding vhost |
|
|
Does it require a full restart of Apache (when running as a service), after adding a new vhost to the configuration? |
|
Back to top |
|
James Blond Moderator
![](images/avatars/3066243e8d00d4770e.gif)
Joined: 19 Jan 2006 Posts: 7342 Location: Germany, Next to Hamburg
|
Posted: Wed 05 Jun '24 12:50 Post subject: |
|
|
Yes, you need to restart to make the changes known to the apache process. |
|
Back to top |
|
Materix
Joined: 30 Aug 2012 Posts: 42
|
Posted: Wed 05 Jun '24 13:08 Post subject: |
|
|
When running Apache as a service on a Windows server, is there a stable method to set Apache to restart once per day? |
|
Back to top |
|
Otomatic
![](images/avatars/24455e7e39169050f.png)
Joined: 01 Sep 2011 Posts: 195 Location: Paris, France, EU
|
Posted: Wed 05 Jun '24 14:48 Post subject: |
|
|
Hi,
With the task scheduler, create a task once a day at the time of your choice.
Code: | httpd.exe -n service_name -k restart |
It is a graceful restart of Apache.
Maybe it won't be enough to support the new VirtualHost, in which case you'll have to stop and restart the service with a batch file. For example:
Code: | net stop service_name
net start service_name |
or
Code: | httpd.exe -n service_name -k stop
httpd.exe -n service_name -k start |
|
|
Back to top |
|
James Blond Moderator
![](images/avatars/3066243e8d00d4770e.gif)
Joined: 19 Jan 2006 Posts: 7342 Location: Germany, Next to Hamburg
|
Posted: Wed 12 Jun '24 11:01 Post subject: |
|
|
A side note: The graceful restart might be preferred since it does not kill an active connection. And the graceful restart is enough to get a new vhost working. |
|
Back to top |
|
Materix
Joined: 30 Aug 2012 Posts: 42
|
Posted: Wed 12 Jun '24 11:38 Post subject: |
|
|
Awesome, thanks for the advice.
Apachelounge.com is the most valuable resource of all for people running Apache on Windows. |
|
Back to top |
|