Apache virtualhost

Hi Guys,

I'm having trouble configuring virtual hosts on apache2.
What i essentially want to do is have 3 sites created in the same way /phpmyadmin is configured.

i want users to be able to go to go to ip address or domain to see the main page and they from there to be able to put /service1, /service2 or /service3 and go to those individual sites.

I've tried to use ServerAlias and Alias in the service1.conf file but it just simply doesn't work.
If i configure those virtual hosts as subdoims it works sine but i want them configured just like /pypmyadmin is.

Any suggestions are welcome.

your config files would be helpful.

1 Like

my bad

This is the config of the main inventory webpage (works fine)
/etc/apache2/sites-available/inventory.conf

<VirtualHost *:80>
    ServerAdmin [email protected]

    ServerName 10.99.100.42
    ServerAlias inventory.uk.domain.eu inventory.uk.domain.eu

    DocumentRoot /var/www/inventory/public_html
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/inventory/public_html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>
</VirtualHost>

Here is one of the sub-pages i want. It's actually instance of netbox,
In this particular example its also using reverse http proxy

/etc/apache2/sites-available/netbox.conf

<VirtualHost *:80>
    ProxyPreserveHost On

    Alias /netbox /opt/netbox/netbox/static

    # Needed to allow token-based API authentication
    WSGIPassAuthorization on

    <Directory /opt/netbox/netbox/static>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
    </Directory>

    <Location /static>
        ProxyPass !
    </Location>

    ProxyPass / http://127.0.0.1:8001/
    ProxyPassReverse / http://127.0.0.1:8001/
</VirtualHost>

And here would be just normal virtual host:
/etc/apache2/sites-available/test.conf

<VirtualHost *:80>
        ServerName 10.99.100.42
        Alias /test/ /var/www/test/public_html
        DocumentRoot /var/www/test/public_html
    <Directory /var/www/test/public_html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Require all granted
    </Directory>

</VirtualHost>

After each change and different setting I've have disabled site, restarted service, enabled site and restarted service again.