Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache virtualhost include

Tags:

apache

config

Connect the apache config files with the command:

include / usr / local / apache / conf / sites / *. conf

Create a file with two virtualhost.

<VirtualHost *>
    ServerAdmin [email protected]
    ServerName site.com
    ServerAlias site.com
    DocumentRoot "/var/www/pachko1/site.com"
</VirtualHost>
<VirtualHost *>
    ServerAdmin [email protected]
    ServerName site1.com
    ServerAlias site1.com
    DocumentRoot "/var/www/site1/site1.com"
</VirtualHost>

But when accessing site1.com always opens a folder of site.com.

If they are interchanged, when referring to site.com will open site1.com

Always works feather rule, why is this happening?

Sorry for my English.

like image 201
Artyom Avatar asked Jan 01 '26 01:01

Artyom


1 Answers

Try adding NameVirtualHost directives:

NameVirtualHost site.com
NameVirtualHost site1.com

and then add the actual host names to the VirtualHost directives:

<VirtualHost site.com>
...
<VirtualHost site1.com>
like image 54
Pekka Avatar answered Jan 02 '26 20:01

Pekka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!