Two domains pointed to the same instance ec2

0

I have two domains, abc.com.br and xyz.com.br. I am pointing both to the same ec2 instance on Amazon. I have two php (wordpress) applications within this instance, one that stays in / var / www / html and another one is in / var / www / html / xyz.

I am not able to properly configure httpd.conf to access through abc.com.br access / var / www / html and xyz.com.br access the site in / var / www / html / xyz

I've added the following code

<VirtualHost xyz.com.br:80>
    ServerAdmin [email protected]
    DocumentRoot "/var/www/html/xyz"
    ServerName xyz.com.br
    Errorlog "logs/error_log"
    CustomLog "logs/access_log" common
    Alias /wedding "/var/www/html/xyz"
</VirtualHost>

<VirtualHost abc.com.br:80>
    ServerAdmin [email protected]
    DocumentRoot "/var/www/html"
    ServerName abc.com.br
    Errorlog "logs/error_log"
    CustomLog "logs/access_log" common
</VirtualHost>
    
asked by anonymous 05.11.2015 / 22:49

1 answer

0

Well, after a lot of trial and error I finally got it!

The first thing I did was add each site in a subfolder. The directory structure looks like this:

/ var / www / html / abc

/ var / www / html / xyz

Then I changed httpd.conf by adding the code below

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/var/www/html/xyz"
    ServerName xyz.com
    ServerAlias www.xyz.com
    Errorlog "logs/error_log"
    CustomLog "logs/access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/var/www/html/abc"
    ServerName abc.com
    ServerAlias www.abc.com
    Errorlog "logs/error_log"
    CustomLog "logs/access_log" common
</VirtualHost>

#DocumentRoot "/var/www/html" Importante comentar essa linha!

Finally, in the screen of setting up each wordpress I put the url of the wordpress and the url of the site the respective domain www.abc.com.br and www.xyz.com.br

    
06.11.2015 / 01:02