ajburch11
By:
ajburch11

Multiple website, single wordpress one droplet apache centos 7

December 28, 2015 890 views
WordPress Apache Configuration Management CentOS

Hello all,

I've come to a stand still while trying to configure multiple sites on one droplet in addition to a Wordpress site that was already in existence, but is now gone due to madness and insanity.

Okay, so I originally installed Wordpress for one domain on the droplet. No problems there. I then created another domain and added it to the same droplet. No problems.

The second domain will not have any Wordpress, it will be used for hosting simple landing pages.

The problems began when I created a my2nddomain.com in the /var/www/html folder which housed my Wordpress files for the first website, thus sending me to the same site as my1stdomain.com.

I then checked out the httpd.conf file and remembered the virtual hosts thing and tried to create two different virtual hosts, with the <virtualhost *:80></virtualhost> lines in the original httpd.conf file. That worked...kind of. When trying to access my1stdomain.com it wasn't recognizing the Wordpress files located in the DocumentRoot directory that I'd named; it was sending me to the index.html file.

So, my final grasp for a semblance of something...I decided to configure everything based off of the tut on creating apache virtual hosts on centos 7.

  • (In addition to everything in the tut) First I tried creating the directories for the individual domains in the /var/www and changed the DocumentRoot for each in their respective .conf to reflect that. Didn't work.
  • Lastly, I tried creating the directories for the individual domains in the /var/www/html, and changed the DocumentRoot for each in their respective .conf. Still not working. I'm lost and blah.

Please keep in mind, I put the Wordpress files in the my1stdomain.com/public_html folder.

Any help is greatly appreciated!!

1 Answer

if your WordPress files are at

/var/www/html/my1stdomain.com/public_html

Then you need 1 virtual host configuration with a DocumentRoot pointed at /var/www/my1stdomain.com/public_html

If your Html files are at

/var/www/html/my2nddomain.com/

then you will need a 2nd virtual host configuration with DocumentRoot pointed at
/var/www/my2nddomain.com/

Here are simple virtual hosts confs, they are brief will need more configuration for WordPress

<VirtualHost *:80>
    ServerName www.my1stdomain.com
    ServerAlias my1stdomain.com
    DocumentRoot /var/www/html/my1stdomain.com/public_html
    ErrorLog /var/log/httpd/my1stdomain.com/error.log
    CustomLog /var/www/my1stdomain.com/requests.log combined
</VirtualHost>

<VirtualHost *:80>
    ServerName www.my2nddomain.com
    ServerAlias my2nddomain.com
    DocumentRoot /var/www/html/my2nddomain.com/
    ErrorLog /var/log/httpd/my2nddomain.com/error.log
    CustomLog /var/log/httpd/my2nddomain.com/requests.log combined
</VirtualHost>
Have another answer? Share your knowledge.