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

Three Considerations for Containers

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read our article on Experts Exchange.

Question has a verified solution.

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

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

632 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