/other/

VPS, Debian 8 install Apache2

2015-12-13 01:17:56

Install Apache2 on Debian

apt-get update
apt-get install apache2

Restart Apache2

service apache2 restart

Install mod_proxy

sudo apt-get install libapache2-mod-proxy-html
apt-get install libxml2-dev
a2enmod proxy proxy_http
service apache2 restart

Example configuration

Assume we have sub-domain shop.example.com and we want to redirect this address to our application deployed on JBoss http://000.000.000.000:8080/shopExample/


<virtualhost shop.example.com:80="">

    ServerAdmin szalek@btbw.pl
    ServerName shop.example.com
    ServerAlias shop.example.com
    ProxyPass / http://000.000.000.000:8080/shopExample/
    ProxyPassReverse / http://000.000.000.000:8080/shopExample/

    ErrorLog ${APACHE_LOG_DIR}/shop.example.com-error_log
    CustomLog ${APACHE_LOG_DIR}/shop.example.com-access_log combined

</virtualhost>