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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now