By heaversm
Hi - I have various subdomains set up successfully as virtual hosts on my Digital Ocean Droplet. For some reason though, my latest subdomain is redirecting to a different subdomain, and I’m not sure why. So if you go to selingo.mikeheavers.com it shows the site for exhibitcolumbus.mikeheavers.com. Furthermore, if you just enter my droplet’s IP address (http://107.170.120.88/), it serves exhibitcolumbus.mikeheavers.com - I would expect it to just serve mikeheavers.com. What have I mixed up?
This is the contents of sites-enabled/selingo.com.conf:
<VirtualHost *:80>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ServerAdmin mheavers@gmail.com
ServerName selingo.mikeheavers.com
ServerAlias www.selingo.mikeheavers.com
DocumentRoot /var/www/selingo/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel warn rewrite:trace8
RewriteEngine On
RewriteCond %{SERVER_NAME} =selingo.mikeheavers.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
and this is the contents of exhibitcolumbus.mikeheavers.com.conf:
<VirtualHost *:80>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
#ServerName www.example.com
ServerName exhibitcolumbus.mikeheavers.com
ServerAlias www.exhibitcolumbus.mikeheavers.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/exhibitcolumbus/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel warn rewrite:trace8
RewriteEngine on
RewriteCond %{SERVER_NAME} =exhibitcolumbus.mikeheavers.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
For both vhosts, I did a sudo a2ensite for the .conf file. I also logged into my control panel and created an ‘a’ record for each subdomain pointing to my IP for the droplet.
I noticed this in /etc/hosts:
127.0.1.1 extra extra
127.0.0.1 localhost
~
I’m not exactly sure what the top one does. I don’t remember setting that up.
Anyone have an idea of where I’ve gone wrong or how to fix / investigate?
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!
Hi there @heaversm,
The Vhost looks correct. I could suggest a couple of things:
Make sure that Apache has read permissions to the /var/www/exhibitcolumbus/public_html directory.
Check the Apache error log for some more information:
- tail -100 /var/log/apache2/error.log
Regards, Bobby
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.