Configuring Display of the Real IP Address in Apache Logs

When using Bitrix 7, you might notice that in the server log, instead of the real IP addresses of users, the Nginx server's IP address ( is displayed, which acts as a proxy server in front of Apache.

To correct this situation, perform the following actions:

1. Open the file /etc/httpd/conf/httpd.conf:

vim /etc/httpd/conf/httpd.conf

2. Find the following lines:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

3. Replace the %h symbol with %{X-Forwarded-For}i in the lines, so they look like this:

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common

4. Save the changes and close the file:


Additionally, you can use the nano editor instead of vim by installing it with the following command:

yum install -y nano

Have more questions about Hosting?