Posted on Leave a comment

Apache2 VirtualHost


intra.conf

<VirtualHost *:8080>
        ServerName intra
        DocumentRoot /var/www/intra
</VirtualHost>

000-default.conf

<VirtualHost *:80>
        DocumentRoot /var/www/default

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog /var/www/default/error.log
        CustomLog /var/www/default/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

IP address in VirtualHost *:80 directive is the one that apache2 binds. It may be different from the public IP if apache2 is behind proxy, etc. Or It can have multiple IPs. In any case, default will be served if no ServerName matches.

To respond to port 8080, apache2 must listen to it.

port.conf

Listen 80
Listen 8080

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>
Leave a Reply

Your email address will not be published. Required fields are marked *