Wednesday, May 22, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1679  / 2 Years ago, wed, september 28, 2022, 6:24:19

I have few web pages on my Ubuntu/Apache server. Now I had to change DocumentRoot for one domain. After I changed DocumentRoot in xyz.conf file, requests to domain does not match desired DocumentRoot directory. Apache keeps the old path in the cache. Now I need to restart Apache, but dont know how to do it only for this domain. Can somebody explain me please how to do it? Thanks a lot.


More From » server

 Answers
2

There is no concept of "only this site" in a simple Apache virtual hosting setup, as all sites are defined in one configuration typically built from many files. There is one server process that may spawn additional processes or threads to serve requests but they each just see the whole config.


To put a configuration change into effect you can mostly do a graceful reload, which is what is happening when you do service reload apache2 or systemctl reload apache2 or apache2ctl graceful. This takes care to finish serving every outstanding request with the old server process and then hand new connections to the new server process that sees the new configuration. There will not be noticeable unavailability. I say "mostly" because there are a couple of configuration changes that do require a full restart.


You asked in comments how production services handle this, if the web server has to be restarted every time there is a configuration change. The answer is that setups which desire high availability would put load balancers in front of web servers so that there were multiple servers available to answer requests. That way a configuration change can be done by rolling reload without clients noticing.


This is done not only for configuration changes; it also helps to protect against problems with any small number of web server hosts. In your current setup you have just this one web server host: if anything happens to it, it all the sites are down.


Very popular web sites will eventually also exceed the ability of a single web server to serve them, so a load balancer is the way to scale horizontally.


The single point of failure then becomes the load balancer, so that too must be made highly available and so it goes on, with ever more complex setups.


[#2029] Thursday, September 29, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
amencisiv

Total Points: 9
Total Questions: 102
Total Answers: 118

Location: Tajikistan
Member since Tue, Mar 21, 2023
1 Year ago
amencisiv questions
;