Question
Why is my Apache VirtualHost directing to the wrong VirtualHost?
On an existing wordpress-installed droplet, I am installing a new wordpress instance (two wordpress installs in same droplet).
To do so, I followed the answer by ryanpq on this thread: https://www.digitalocean.com/community/questions/is-it-possible-to-install-another-wordpress-on-droplet
Similar to the commenters on that thread, my newer site redirects to my existing site (even after changing the DocumentRoot
and Directory
appropriately).
Here are my configs:
Within /etc/apache2/sites-enabled
, I have 4 files: 000-default-le-ssl.conf 000-default.conf example1.conf example2.conf
000-default.conf and
example1.conf` are copies.
example1.conf
looks like so:
# Added to mitigate CVE-2017-8295 vulnerability
UseCanonicalName On
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName example1.io
ServerAlias www.example1.io
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.example1.io [OR]
RewriteCond %{SERVER_NAME} =example1.io
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
example2.conf
looks like so:
<VirtualHost *:80>
ServerAdmin webmaster@example2.com
ServerName example2.com
ServerAlias www.example2.com
DocumentRoot /var/www/example2
<Directory /var/www/example2/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
my directory structure looks like /var/www/html
and /var/www/example2
Within the control panel of my DO account, I created a new project for my newly acquired domain name.
I created new A and CNAME records. The A record points to the IP address of the older, existing, site (so, example2.com directs to 128....)
Additional: I noticed while following the user ryanpq’s answer, that the wordpress install I did only had a wp-config-sample.php, so I copied that file, named it wp-config.php
and filled it in with the database info.
What am I missing?
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.
×