LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-07-2015, 05:18 AM   #1
raheel_com88
LQ Newbie
 
Registered: Nov 2012
Location: Islamabad, Pakistan
Posts: 19

Rep: Reputation: Disabled
Apache Default Index page Not working after VirtualHost Configuration


Hi

I have recently installed Apache 2.4.6 on CentOS 7. I have created an index page in /var/www/html and check it which was working fine. After that I configured two virtual hosts having different content and problem now is that when i type the IP address of my WebServer in browser, it takes me to index page of virtual host 1 instead of index page in /var/www/html. Index page of virtualhost 2 is working fine. See the following configuration:

Default (/etc/httpd/conf/httpd.conf):
ServerName default.com
DocumentRoot /var/www/html

VirtualHost1 (/etc/httpd/conf.d/example.com.conf):
ServerName example.com
DocumentRoot /var/www/example.com/public_html

VirtualHost1 (/etc/httpd/conf.d/example.org.conf):
ServerName example.org
DocumentRoot /var/www/example.org/public_html

Can anyone please tell me how to resolve this issue.

Raheel

Last edited by raheel_com88; 09-07-2015 at 05:22 AM.
 
Old 09-08-2015, 02:11 AM   #2
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
From http://httpd.apache.org/docs/2.2/vhosts/name-based.html

Quote:
Main host goes away

If you are adding virtual hosts to an existing web server, you must also create a <VirtualHost> block for the existing host. The ServerName and DocumentRoot included in this virtual host should be the same as the global ServerName and DocumentRoot. List this virtual host first in the configuration file so that it will act as the default host.
 
Old 09-08-2015, 03:11 AM   #3
raheel_com88
LQ Newbie
 
Registered: Nov 2012
Location: Islamabad, Pakistan
Posts: 19

Original Poster
Rep: Reputation: Disabled
Which configuration file? httpd.conf or some other .conf file like 1 i made for example.com
 
Old 09-09-2015, 02:35 PM   #4
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
You have to make another one for default.com, or put the config for default.com as a virtual host config to the beginning of your first virtual host config file
 
  


Reply

Tags
apache, centos7, default, redirection, virtualhost



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
customise ftp / http directory list index page, colorful index page Gil@LQ Linux - Networking 6 06-17-2013 09:20 AM
How to change the default webpage configuration from index.php to index.htm, etc meema Linux - Server 4 08-22-2008 09:06 PM
if there is no index file i get a default apache page W0uter Linux - Server 2 10-27-2006 02:31 AM
index.asp as default page daveuk Linux - Software 2 09-13-2002 01:51 AM
In apache, i want to set my default page to be index.html, or something thep Linux - Newbie 3 04-17-2001 02:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration