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 Answers 3

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.

0
0

Yes Apache configuration need a server restart

2
0

Yes

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

You must log in to answer this question.