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
379 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
This solved my issue
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

14 Experts available now in Live!

Get 1:1 Help Now