Setting up Virtual Host in Fedora Core 15 using apache

Posted by Roland on Server Fault See other posts from Server Fault or by Roland
Published on 2011-09-11T09:07:40Z Indexed on 2013/11/01 21:58 UTC
Read the original article Hit count: 171

Filed under:
|
|

I'm trying to setup a couple of Virtual Host files on my Localhost PC running Fedora Core 15.

Now I get this working, but now onloy one Virtual Host site works, and if I type in 127.0.0.1/test/testApp.php which is not related to the Virtual Host site , I get redirected to the Virtual Host site.

Here's what I did.

  1. I created a new folder called virtualhosts in /etc/httpd/ where all my host files are stored in the following format site.conf
  2. In /etc/conf/httpd.conf I enabled NameVirtualHost *:80 and included the host files at the bottom of the config page like this Include virtualhosts/*.conf
  3. In /etc/hosts I added the line 127.0.0.1 website

No when I run sudo httpd -t I get Syntax OK

I restart apache and then the Virtualhost works, but as soon as I add other hosts and only use 127.0.0.1 as above it still links to the original host.

Am I doing anything wrong here or left out something?

An example of my Virtual Host file looks like this

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    DocumentRoot /var/www/html/website/ 
    ServerName website 
    ServerAlias website 
    ErrorLog logs/dev-error_log 
    CustomLog logs/dev-access_log common 
    Alias /blog /var/www/html/blog/ 
    <Directory /var/www/html/website/> 
       Options FollowSymLinks 
       Allow Override 
       All Order allow,deny allow from all 
    </Directory> 
    #php_value error_reporting E_ALL & ~E_NOTICE & ~E_DEPRECATED 
    php_flag display_errors On 
    php_value date.timezone Europe/London 
 </VirtualHost>

© Server Fault or respective owner

Related posts about httpd

Related posts about httpd.conf