1

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

3 Answers3

5

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.

Chrispy
  • 126
  • 1
  • 3
0

Yes Apache configuration need a server restart

Julien Ducro
  • 101
  • 3
  • Great. Thanks! Can you also confirm I'm making the proper change from %h to %{X-Forwarded-For}i –  Dec 07 '11 at 00:51
  • You should maybe keep the %h and add the %{X-Forwarded-For}i as supplementary info: http://blog.loadbalancer.org/apache-and-x-forwarded-for-headers/ – Julien Ducro Dec 07 '11 at 01:20
0

Yes

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

ckliborn
  • 2,778
  • 4
  • 25
  • 37