• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

Apache for Newbie: Set up Apache with mod_remoteip

December 17, 2023

Apache for Newbie: Set up Apache with mod_remoteip

Apache is one of the most popular web servers in the world, known for its flexibility and robustness. If you are new to Apache and want to learn how to set it up with mod_remoteip, this article is for you. Mod_remoteip is a module that allows Apache to log the original client IP address instead of the IP address of a proxy or load balancer.

Why use mod_remoteip?

When your website is behind a proxy or load balancer, Apache logs the IP address of the proxy or load balancer instead of the actual client IP address. This can make it difficult to track and analyze visitor data accurately. Mod_remoteip solves this problem by replacing the logged IP address with the client’s IP address.

Setting up mod_remoteip

To set up mod_remoteip, follow these steps:

Step 1: Enable mod_remoteip

The first step is to enable the mod_remoteip module in Apache. Open your Apache configuration file, which is usually located at /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf. Look for the line that starts with #LoadModule remoteip_module and remove the # at the beginning to uncomment the line. Save the file and exit.

Step 2: Configure mod_remoteip

Next, you need to configure mod_remoteip to recognize the IP address of your proxy or load balancer. Add the following lines to your Apache configuration file:

RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 10.0.0.1

Replace X-Forwarded-For with the header name used by your proxy or load balancer to pass the client IP address. Replace 10.0.0.1 with the IP address of your proxy or load balancer. If you have multiple proxies or load balancers, you can add additional RemoteIPInternalProxy lines for each IP address.

Step 3: Restart Apache

After configuring mod_remoteip, restart Apache to apply the changes. Run the following command in your terminal:

sudo service apache2 restart

If you are using a different distribution or operating system, the command may vary. Refer to your system’s documentation for the correct command.

Verifying mod_remoteip

To verify that mod_remoteip is working correctly, you can check the Apache access logs. The logged IP addresses should now be the client’s IP addresses instead of the proxy or load balancer IP addresses.

Summary

Setting up Apache with mod_remoteip allows you to log the actual client IP address instead of the IP address of a proxy or load balancer. This is essential for accurate tracking and analysis of visitor data. By following the steps outlined in this article, you can easily configure mod_remoteip and ensure that your Apache server logs the correct IP addresses.

If you are looking for reliable VPS hosting solutions, consider Server.HK. With our top-notch VPS hosting services, you can enjoy the benefits of a powerful and secure hosting environment.

Recent Posts

  • Hong Kong VPS for Live Streaming: RTMP Server Setup and Low-Latency Delivery to China (2026)
  • How to Set Up a Mail Server on Hong Kong VPS: Postfix, Dovecot, and Email Deliverability (2026)
  • How to Run a SaaS Product on Hong Kong VPS: Architecture and Deployment Guide 2026
  • Hong Kong VPS Uptime and SLA: What 99.9% Uptime Really Means for Your Business (2026)
  • Cryptocurrency and USDT Payment for VPS Hosting: Why It Matters for Global Businesses (2026)

Recent Comments

  1. Hong Kong VPS Uptime and SLA: What 99.9% Uptime Really Means for Your Business (2026) - Server.HK on How to Monitor Your Hong Kong VPS: Uptime, Performance, and Alert Setup Guide (2026)
  2. Best Hong Kong VPS Providers in 2026: Compared by Speed, Routing, and Value - Server.HK on How to Migrate Your Website to a Hong Kong VPS: Zero-Downtime Transfer Guide (2026)
  3. vibramycin injection on How to Choose the Right Hong Kong VPS Plan: A Buyer’s Guide for 2026
  4. allopurinol for gout on CN2 GIA vs BGP vs CN2 GT: What’s the Real Difference for China Connectivity?
  5. antibiotics online purchase on How to Set Up a WordPress Site on a Hong Kong VPS with aaPanel (Step-by-Step 2026)

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot