<VirtualHost *:80> Include /etc/apache2/{{ apache_conf_dir|default('conf-available') }}/global-redirect.conf ServerName {{ inventory_hostname }} <Location /server-status> SetHandler server-status Order Deny,Allow Deny from all Allow from 127.0.0.1{% for address in ansible_all_ipv4_addresses %} {{ address }}{% endfor %} </Location> SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded LogLevel warn {% if apache_version|default('2.4') == '2.4' %} ErrorLogFormat "[%{u}t] [%l] [pid %P] [client\ %{X-Forwarded-For}i] %M% ,\ referer:\ %{Referer}i" {% endif %} LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined env=!forwarded CustomLog ${APACHE_LOG_DIR}/access.log proxy env=forwarded </VirtualHost>