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
link|improve this question
feedback

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

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

3 Answers

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.

link|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
feedback

Yes Apache configuration need a server restart

link|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
feedback

Yes

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown