How to set Apache to accept new virtual host without restarting the service

Discussion in 'Apache' started by smilesquare, Jul 26, 2008.

  1. #1
    Sometimes, I have new domains/ sub domains and want to have their log file individually.

    How to set Apache to accept new virtual host without restarting the service?
     
    smilesquare, Jul 26, 2008 IP
  2. klimu

    klimu Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I suppose graceful restart is the closest thing you can get. It will finish current requests and start with new config afterwards.


    ----

    Logs
    Apache is usually set to record messages in the error_log and the access_log files located in /var/log/httpd. However, you may want each virtual host to have its own logs. Add the following to a vhost block to change its log settings:

    ErrorLog /var/log/httpd/client_a-error_log common
    CustomLog /var/log/httpd/client_a-access_log commonOf course, you'll have to create the new log files, too. They're plain text files and can be created with the touch command:

    touch /var/log/httpd/client_a-error_logBe sure to change the permissions and ownership appropriately. Depending on your configuration, these commands may resemble:

    % chmod 644 client*
    % chown apache:apache client*
     
    klimu, Jul 28, 2008 IP
  3. hoodvs

    hoodvs Peon

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yep, he's right ^^, the command you're likely looking for is:
    'apachectl graceful' - although you may want to test if it will work by running 'apachectl configtest' beforehand. (On some machines this is named apache2ctl, for apache 2.x trees).
    Good luck!
     
    hoodvs, Jul 30, 2008 IP