Apache2 virtualhosts config problem
I created directories for each of the sites in /var/www/public_html/domainname/public,private,log,etc…
I created a basic html file for each site and placed it /var/www/public_html/domainname/public/index.html
I edited the apache2.conf file and added the lines
Include /etc/apache2/sites-enabled/
ServerName 97.107.133.117
NameVirtualHost *:80
- I created a vhost file for each domain and placed them /etc/apache2/sites-available/domain1.com
the content of the file was:
Place any notes or comments you have here
It will make any customisation easier to understand in the weeks to come
domain: domain1.com
public: /home/var/www/public_html/domain1.com/
ServerAdmin
ServerName 97.107.133.117
ServerAlias www.****domain1.com****
Index file and Document Root (where the public files are located)
DirectoryIndex index.html
DocumentRoot /home/var/www/public_html/domain1.com/public
Custom log file locations
LogLevel warn
ErrorLog /home/var/www/public_html/domain1.com/log/error.log
CustomLog /home/var/www/public_html/domain1.com/log/access.log combined
-I used the command sudo a2ensite domain1.com for each of the sites. I rebooted Apache after each.
The problem is: I point the browser at the IP 97.107.133.117 and the default html does not show. I am not sure if I set things up right. Any help or comments would be appreciated
2 Replies
Try setting up DNS, and try it with your config.
I think the problem is that you have the servername set to your IP address, if this is the same for each vhost, apache cant distinguish where to point to.
This is a sample of one of my vhosts.
<virtualhost *:80="">ServerAdmin webmaster@domain.tld
DocumentRoot "/srv/http/domain.tld"
ServerName domain.tld
ServerAlias domain.tld
ErrorLog "/var/log/httpd/domain.tld.error_log"
CustomLog "/var/log/httpd/domain.tld.access_log" common</virtualhost>