Two domains pointed to the same instance ec2

Asked

Viewed 305 times

-1

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

I am not being able to properly configure httpd.conf to access the site in /var/www/html and Xyz.com.br by accessing the site in /var/www/html/Xyz

I 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>

1 answer

0

Well, after several attempts and error I finally managed!

The first thing I did was add each site to a subfolder. The directory structure looked 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, on the configuration screen of each wordpress I put the wordpress url and the site url the respective domain www.abc.com.br and www.xyz.com.br

Browser other questions tagged

You are not signed in. Login or sign up in order to post.