Reputation: 397
I'd like to know if name-based virtual hosting is the same as domain mapping as that is what I am trying to achieve.
I am trying to host multiple folders/websites on the same server/ip address
This is what my virtual host/apache2.conf looks like I have restarted apache2 and no dice, always going to the root or var/www folder showing a directory/index list
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.site1.us
ServerAlias site1.us
DocumentRoot /var/www/site1
</VirtualHost>
<VirtualHost *:80>
ServerName www.site2.com
ServerAlias site2.com
DocumentRoot /var/www/site2
</VirtualHost>
Perhaps I can do it by .htaccess instead, I would like to have my websites point to their individual domains.
The other problem is that the links within each folder/site point back to the primary ip/location eg. /var/www so that's messed up as well.
I was following the manual here and I don't know what I am missing
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
Upvotes: 0
Views: 46
Reputation: 1377
If you're getting a directory listing, you might not have access/permissions for where you put the files. I had that problem until I set up a symlink and added a Directory directive to my host definition. It looked like this:
<Directory "/">
Require all granted
Options FollowSymLinks
AllowOverride None
</Directory>
Hopefully that helps.
Upvotes: 0