Wednesday, February 20, 2013

Apache Mod_Proxy | Port Redirection by Apache

Redirect port from to

sudo apt-get install libapache2-mod-proxy-html
sudo apt-get install libxml2-dev
sudo a2enmod proxy proxy_html

cd etc/apache2/mods-available

vim proxy.conf

# If you want to use apache2 as a forward proxy, uncomment the
# 'ProxyRequests On' line and the block below.
# WARNING: Be careful to restrict access inside the block.
# Open proxy servers are dangerous both to your network and to the
# Internet at large.
# If you only want to use apache2 as a reverse proxy/gateway in
# front of some web application server, you DON'T need
# 'ProxyRequests On'.

ProxyRequests Off

        AddDefaultCharset off
        Order deny,allow
        Deny from all
        Allow from all
ProxyPass /
ProxyPassReverse /

# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
ProxyVia Off

/etc/init.d/apache2 restart

IN case you have SSL

/etc/init.d/apache2 restart
sudo a2enmod proxy proxy_html

in : /etc/apache2/sites-enabled
#cat default-ssl

        SSLProxyEngine On
        ProxyPass / https://localhost:8181/
        ProxyPassReverse / https://localhost:8181/

No comments:

Post a Comment