Solved

Not able to setup up two domain in one server using virtual host in Cent OS 6.x

Posted on 2013-06-14
4
387 Views
Last Modified: 2013-06-22
I am trying to set up two domains on a single server using virtual host concept (server is Cent OS 6.X). But i am having some issues which i am not able to figure out why are they cropping up.

Process which i have followed for setting up two domains one a single apache web server is as follows:

I have two sub-folder in my /var/www/html/ folder as:
>     1. /var/www/html/site1.com
>     2. /var/www/html/site2.com

In my httpd.conf file i have:

> 1. Include conf.d/*.conf
> 2. NameVirtualHost *:80    
 `<VirtualHost *:80> </VirtualHost>`

In my conf.d folder i have two .conf files as

> site1.com.conf

    <VirtualHost *:80>
         ServerAdmin admin@admin.com
         DocumentRoot /var/www/html/site1.com
         ServerName site1.com
         ServerAlias www.site1.com
         ErrorLog logs/site1.com-error_log
         TransferLog logs/site1.com-access_log
   
         <Directory /var/www/html/site1.com/>
         AllowOverride FileInfo Options
         </Directory>
    </VirtualHost>

> site2.com.conf

    <VirtualHost *:80>
         ServerAdmin admin@admin.com
         DocumentRoot /var/www/html/site2.com
         ServerName site2.com
         ServerAlias www.site2.com
         ErrorLog logs/site2.com-error_log
         TransferLog logs/site2.com-access_log
         <Directory /var/www/html/site2.com/>
         AllowOverride FileInfo Options
         </Directory>
    </VirtualHost>

Now after all this if i open www.site1.com through browser, i am able to access the site1.com content.

But when i try to access www.site2.com through browser, i am getting apache default page.

In my site2.com-access_log, following error is being logged

    [12/Jun/2013:16:25:45 +0000] "GET / HTTP/1.1" 403 5039

In my site2.com-error.log, following error is being logged

    [Wed Jun 12 16:35:29 2013] [client 125.125.98.85] (13)Permission denied: access to /index.php denied

As for directory permission, **root** is the owner for both the **site1.com** and **site2.com** folders.

Please if any has any idea what wrong i am doing here will be most appreciated or if anyone can point me how i can accomplish this will be most welcome.

Thanks in advance.
0
Comment
Question by:OTSSolutions
  • 2
4 Comments
 

Expert Comment

by:chrisvee
ID: 39247390
i think its the issue with .htaccess file.

anyway try this:

create a new folder in var/site2.com
migrate your files
change DocumentRoot to /var/site2.com in  .conf
0
 
LVL 4

Expert Comment

by:Christopher Raymond Mendoza
ID: 39247934
Hello OTSSolutions,

It is possible that the problem is caused by root having sole access to index.php. Have you checked the permissions of /var/www/html/site2.com and all the files and sub-directories inside?

Regards,
0
 

Accepted Solution

by:
OTSSolutions earned 0 total points
ID: 39253277
Hi All,

Thanks for your input i have solved it by
setenforce 0

Open in new window

. It seems there was some issues with SElinux.
0
 

Author Closing Comment

by:OTSSolutions
ID: 39267761
This solved my issue
0

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best practices for sharing large amounts of data 9 109
Create sub domain on windows dedicated server. 13 75
Soundcloud.com 4 83
Create link to folder for use with apache. 7 77
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question