I'm currently using name-based virtual host configuration, to server about 5 different websites from the same IP address, just like in the apache documentation:
<VirtualHost *:80> ServerName www.domain.tld DocumentRoot /www/domain </VirtualHost> <VirtualHost *:80> ServerName www.otherdomain.tld DocumentRoot /www/otherdomain </VirtualHost>
Is it possbile to have something like:
<VirtualHost *:80> ServerName www.domain.tld/folderpath DocumentRoot /www/software </VirtualHost>
The webpages in this folder are using a different software stack, and I'd like to keep it nicely separate. I tried the method above but it didn't work.
Apache Virtual Hosts allows you to run more than one website on a single machine. With Virtual Hosts, you can specify the site document root (the directory which contains the website files), create a separate security policy for each site, use different SSL certificates and much more.
The first step is to create a <VirtualHost> block for each different host that you would like to serve. Inside each <VirtualHost> block, you will need at minimum a ServerName directive to designate which host is served and a DocumentRoot directive to show where in the filesystem the content for that host lives.
It's not possible the way you show - a VirtualHost
is always just a host. But you could use an Alias.
<VirtualHost *:80> ServerName www.domain.tld DocumentRoot /www/domain Alias /folderpath /www/software </VirtualHost>
Is it possible to have a different vhost for each application like that:
<VirtualHost *:80> ServerName www.domain.tld DocumentRoot /www/domain </VirtualHost> <VirtualHost *:80> ServerName www.domain.tld Alias otherApp /www/otherApp </VirtualHost>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With