This guide explains how to configure Apache to proxy requests to the ISPConfig web panel on CentOS 7.

Prerequisites

  • CentOS 7 system with Apache installed and running
  • ISPConfig already installed and functioning
  • Root or sudo access to modify Apache configuration files

Configuration Steps

1. Enable Required Apache Modules

First, ensure that the necessary Apache modules for proxying are enabled:

# Enable required modules
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests

If the a2enmod command is not available on your CentOS 7 system, you can check if the modules are already loaded:

# Check if proxy modules are loaded
httpd -M | grep proxy

The required modules are typically enabled by default in the CentOS Apache package.

2. Create a Virtual Host Configuration

Create a new configuration file for your proxy:

# Create a new virtual host configuration file
sudo vi /etc/httpd/conf.d/ispconfig-proxy.conf

3. Configure the Virtual Host

Add the following directive to the configuration file:

<VirtualHost *:80>
    # Replace with your domain or IP address
    ServerName panel.yourdomain.com
    
    # Server admin email
    ServerAdmin webmaster@yourdomain.com
    
    # Enable proxy for ISPConfig
    ProxyRequests Off
    ProxyPreserveHost On
    
    # Proxy settings for ISPConfig web panel
    # Replace 192.168.1.100 with the actual IP of your ISPConfig server
    ProxyPass / http://192.168.1.100:8080/
    ProxyPassReverse / http://192.168.1.100:8080/
    
    # Logging configuration
    ErrorLog /var/log/httpd/ispconfig_error.log
    CustomLog /var/log/httpd/ispconfig_access.log combined
    
    # Optional: Set timeout values if needed
    ProxyTimeout 300
</VirtualHost>

Make sure to replace:

  • panel.yourdomain.com with your actual domain name
  • webmaster@yourdomain.com with your admin email
  • 192.168.1.100 with the actual IP address of your ISPConfig server
  • 8080 with the actual port if ISPConfig is running on a different port

4. Test the Configuration

Check the Apache configuration syntax:

# Verify the syntax of your Apache configuration
sudo httpd -t

5. Restart Apache

If the syntax check passes, restart Apache to apply the changes:

# Restart Apache web server
sudo systemctl restart httpd

6. Configure SELinux (if enabled)

If SELinux is enabled on your system, you need to allow Apache to make network connections:

# Allow Apache to connect to the network
sudo setsebool -P httpd_can_network_connect 1

7. Configure Firewall (if enabled)

If firewalld is running, ensure that port 80 is open:

# Allow HTTP traffic through the firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

Troubleshooting

Check Apache Error Logs

If you encounter issues, check the Apache error logs:

# View Apache error logs
sudo tail -f /var/log/httpd/ispconfig_error.log

Verify Network Connectivity

Ensure Apache can reach the ISPConfig server:

# Test network connectivity to ISPConfig
curl -I http://192.168.1.100:8080

Common Issues

  1. 403 Forbidden errors: Check the permissions on the ISPConfig server
  2. 502 Bad Gateway: Verify that ISPConfig is running and accessible
  3. Redirect loops: Ensure ProxyPassReverse is configured correctly

Conclusion

Your Apache server should now be configured to proxy requests to the ISPConfig web panel. You can access the ISPConfig interface by navigating to your proxy domain (e.g., http://panel.yourdomain.com) in a web browser.