Trouble setting up two wordpress sites on the same droplet

Posted January 23, 2018 1.1k views
ApacheWordPressUbuntu 16.04


I have already one wordpress site on my droplet and want to get one more.

I have done this:

touch /etc/apache2/sites-available/

<VirtualHost *:80>
DocumentRoot /var/www/html/
RewriteEngine on
RewriteCond %{SERVER
RewriteRule ^ https://%{SERVERNAME}%{REQUESTURI} [END,NE,R=permanent]
<VirtualHost *:80>

RewriteEngine on
RewriteCond %{SERVERNAME}
RewriteRule ^ https://%{SERVER
NAME}%{REQUEST_URI} [END,NE,R=permanent]

sudo mkdir -p /var/www/html/

sudo chown -R $USER:$USER /var/www/html/

sudo chmod -R 755 /var/www/html/

sudo a2ensite

sudo service apache2 reload

And then I did this beacuse it don’t work:

nano /var/www/html/

<title>Welcome to!</title>
<body> <h1>Success! The virtual host is working!</h1>

sudo a2dissite 000-default.conf

sudo systemctl restart apache2

sudo service apache2 restart

My /etc/hosts/ benja2 benja2 localhost

I have an A and AAAA dns record for using same IP as my first site. redirects to my first site.

What am I missing? Thanks !!

1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

| And then I did this beacuse it don’t work:

Can you clarify here? What happened when you restarted apache? Was an error reported? I would recommend reviewing your error log /var/log/apache2/error.log as this file will contain further details on what went wrong.

Hi, ryanpg,

I have solved the problem.

The caching plugin w3 did I could only access the site from /wp-admin because I had deleted w3’s file in wp-config.php to avoid caching. I had no error code, page was not there.

The error log showed problems with w3 and was what pointed me in the correct direction.

Deactivating the plugin w3 and getting SSL-certificate on both virtual hosts did the trick.

Further more I changed my second virtual host to a virtual host not being encrypted. (before getting the SSL-certificate.)

Thanks for helping.