[HELP] Apache Reverse Proxy Setup

July 28, 2015 2.9k views
Apache Ubuntu FAQ Networking

I need help setting this up. It almost works but not quite. Instead of taking me to https://mydomain.com/sabnzbd it goes to https://localhost:9090/sabnzbd

Machine 1 = Windows 8.1 with Sabnzbd https://localhost:9090 (SSL)
Local IP
Machine2 = Ubuntu 14.04 Server with Apache
Local IP
Both Machines on same external IP

a2enmod proxy
a2enmod proxy_http
a2enmod headers
a2enmod rewrite
a2enmod ssl

sites-enabled = 000-default.conf | default-ssl.conf | servername.conf


<VirtualHost *:80>
   Redirect permanent / https://mydomain.com/


<VirtualHost _default_:443>
   Header always add Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
   ProxyRequests Off
   ProxyPreserveHost On
   AllowEncodedSlashes NoDecode
  <Location /sabnzbd>
    order allow,deny
    allow from all
    ProxyPass http://mydomain.com:9090/sabnzbd
    ProxyPassReverse http://mydomain.com:9090/sabnzbd
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/mycert.crt
SSLCertificateKeyFile /etc/apache2/ssl/mykey.key


ServerName mydomain.com
1 Answer

If you have port forwarding set up properly for your network so that requests to port 80 and 443 are routed to machine 2 and those for port 9090 are routed to machine 1 and your domain is pointed properly this should work as you expect. If you are running this on a home network, there is a very good chance that ports 80 and possibly 443 are blocked by your ISP as it’s fairly common for ISPs to block these and standard mail ports.

Have another answer? Share your knowledge.