eeror adding 2 Domain to Apache virtual host
When I go to Technopath.ca it sends me to my server ip address, no masking or anything
I want it to go to a specific folder patpro.ca/public_html/wp/
is there anything im doing wrong? when i disable patpro.ca.conf technopath.ca works but wasn't showing css code whats going on!!
Help me please
Config Files
Patpro.ca.conf
Directory /var/www/html/patpro.ca/public_html
Require all granted
/Directory
VirtualHost *:80
ServerName patpro.ca
ServerAlias www.patpro.ca
ServerAdmin email@gmail.com
DocumentRoot /var/www/html/patpro.ca/public_html
ErrorLog /var/www/html/patpro.ca/logs/error.log
CustomLog /var/www/html/patpro.ca/logs/access.log combined
/VirtualHost
WP.conf
Directory /var/www/html/patpro.ca/public_html/wp/
Require all granted
/Directory
VirtualHost *:80
ServerName technopath.ca
ServerAlias www.technopath.ca
ServerAdmin email@gmail.com
DocumentRoot /var/www/html/patpro.ca/public_html/wp/
ErrorLog /var/www/html/patpro.ca/logs/error.log
CustomLog /var/www/html/patpro.ca/logs/access.log combined
/VirtualHost
1 Reply
Your configuration is wrong (for both of them). If you think of
<VirtualHost>
</VirtualHost>
as defining a "container", the
<Directory>
</Directory>
directives have to be "inside" the container. The way you have them, the directory definitions aren't in any virtual host (in either case).
You need to do each of them like this:
<VirtualHost *:80>
# Admin email and server name
#
ServerName ...
ServerAlias www. ...
# The server will not send it's signature
#
ServerSignature Off #optional
# Index file and document root
#
DocumentRoot /my/doc/root
DirectoryIndex index.html #index.php If you're going to use WP, you need this
# Turn on the rewrite engine (mod_rewrite)
#
<IfModule mod_rewrite.c>
RewriteEngine on # If you're going to use WP, you probably need this
</IfModule>
# The docroot
#
<Directory /my/doc/root>
AllowOverride All
Options -Indexes -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
# Some directory
#
<Directory /some/directory/somewhere>
AllowOverride All
Options -Indexes -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
# Some other directory
#
<Directory /some/other/directory/somewhere>
AllowOverride All
Options -Indexes -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
# Log file locations
#
LogLevel warn
ErrorLog "| /usr/bin/rotatelogs -l /var/log/...
CustomLog "| /usr/bin/rotatelogs -l /var/log/...
</VirtualHost>
This assumes you're using Apache 2.4. If you're using Apache 2.2, the Require directives will be different. Others may be as well. RTFM.
Put each VirtualHost definition in a separate file and then enable and disable them with a2ensite (for enablement) and a2dissite (for disablement).
-- sw