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
389 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

759 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