d.ariel d.ariel - 27 days ago 8
Apache Configuration Question

Virtualhost problems. Have two vhost files but results are unexpected 2nd site does not load properly

I have 1 ubuntu 14.04 server from DO and two independant WordPress installations I'm trying to run off the same server

Have two apache vhost config files:

000-default.conf and 001-default.conf


Now when navigating to
domain1.com
everything works flawlessly. The entire website is working as expected. But there is a problem with going to
domain2.com
it will automatically redirect to
domain1.com
. Basically the problem is I can't get to the WordPress installation screen on
domain2.com


Here is the conf file under sites available for domain1.com (000-default.conf):

<VirtualHost *:80>
ServerAdmin email@gmail.com
ServerName domain1.com
ServerAlias www.domain1.com
DocumentRoot /var/www/html

<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


config file for domain2.com (001-default.conf):

<VirtualHost *:80>
ServerAdmin email@gmail.com
ServerName domain2.com
ServerAlias www.domain2.com

DocumentRoot /var/www/htmlposts
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/htmlposts>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


Additional information:
In /var/www/html I have the WordPress files for domain1.com and everything works.

In /var/www/htmlposts/ I have extracted the WordPress files for domain2.com
it looks like this: http://prntscr.com/d4h9gu

I have created an index.html file in
/var/ww/htmlposts
which is the directory for
domain2.com
and when I navigate to
domain2.com/index.html
the file displays as expected but when I navigate to
domain2.com/wp-admin/install.php
which should start the wp installation process for instance #2 "domain2.com" it shows an already installed error which looks like this: http://prntscr.com/d4hhav

There are two databases on the server. One is for domain1.com and the other database is an empty one that I created for domain2.com. Both are correctly pointed in their respective wp-config.php files.

Answer

Can you compare the config.php of the 2 sites. Make sure that the database names in both the config.php files are different.

Comments