I have two domains hosted on my droplet, I have the virtual hosts setup. But my second domain keeps going to the first one’s directory for some reason.
This is the Apache VHosts file for the first one:
<VirtualHost *:80> ServerAdmin webmaster@localhost
DocumentRoot /var/www/computingessentials
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog "/var/www/computingessentials/logs/error_log"
</VirtualHost>
And this is for the second one:
<VirtualHost *:80> ServerAdmin webmaster@localhost
DocumentRoot /var/www/crunchyvps
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog "/var/www/crunchyvps/logs/error_log"
</VirtualHost>
I have used ajenti to generate both of the files
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Can you <a href=“http://pb.gparent.org/”>pastebin</a> both of your virtualhosts?
From what you posted, it looks like you’re missing the ServerName directives. Each virtual host section needs a ServerName directive to tell it what domain name to listen for. Optionally, you can also use a ServerAlias directive to assign additional domain names: <br> <br>ServerName example.com <br>ServerAlias *.example.com <br> <br>Apache will, by default, assign the first virtual host loaded to be the fallback so any unrecognized domains will go there.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.