Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am going to be making a change in my apache2.conf file, do I need to restart the server in order for these changes to take effect?

Specifically, I'm changing %h to %{X-Forwarded-For}i

From:

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

To:

LogFormat "%v:%p %{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
share|improve this question

migrated from stackoverflow.com Dec 9 '11 at 20:10

This question came from our site for professional and enthusiast programmers.

3 Answers 3

Yes, when you edit the config files for apache, the first thing to do is run apachectl configtest (or apache2ctl configtest for apache2).

This will tell you if you've any errors in your configuration before you try and restart the server. If you've just brokken your configuration with an edit, calling restart will stop the server and bail with an error when it tried to start, leaving your web service down.

share|improve this answer
    
Thanks so much for the input! –  Mr RSX Mr RSX Dec 7 '11 at 18:28
    
Why not mark an accepted answer ;) –  thinice Dec 9 '11 at 20:12

Yes Apache configuration need a server restart

share|improve this answer
    
Great. Thanks! Can you also confirm I'm making the proper change from %h to %{X-Forwarded-For}i –  Mr RSX Mr RSX Dec 7 '11 at 0:51
    
You should maybe keep the %h and add the %{X-Forwarded-For}i as supplementary info: blog.loadbalancer.org/apache-and-x-forwarded-for-headers –  Pompom6784 Dec 7 '11 at 1:20
    
Will take a look at that link. Thanks for your input. Much appreciated! –  Mr RSX Mr RSX Dec 7 '11 at 18:29

Yes

I'd recommend a "graceful" restart after a config test

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.