Fedora Linux Support Community & Resources Center
  #1  
Old 5th June 2010, 07:45 PM
dlux45 Offline
Registered User
 
Join Date: Dec 2007
Location: Lagos - Nigeria
Age: 28
Posts: 71
linuxopera
Apache & Virtual Host

Please i need to run more than two websites on Fedora, say my website www.game.com and www.speed.com as virtual host. please, i'm running as a localhost. server name's virtual host. port number 80. the right <Virtual Host> Code </Virtual Host> or <localhost> code </localhost> how please.
Reply With Quote
  #2  
Old 6th June 2010, 04:25 AM
CiaW's Avatar
CiaW Offline
Registered User
 
Join Date: May 2009
Location: eastern Washington (state) USA
Posts: 489
linuxfedorafirefox
Re: Apache & Virtual Host

It took me many hours of searching and trying different things to get virtual hosts working for my localhost, see below.

in your httpd.conf file you can add the following to the bottom under the sample virtual host, using your specifics of course in place of 'name':
Code:
<VirtualHost *:80>
    ServerAdmin name@localhost.localdomain  #(or just use root @ localhost if you prefer)
    DocumentRoot /var/www/sitename
    ServerName sitename.local #or whatever you're using
	ServerAlias  sitename
    ErrorLog logs/sitename-error_log
    CustomLog logs/sitename.local-access_log common
<Directory /var/www/sitename>
Options Indexes Includes FollowSymLinks
AllowOverride None
Allow from all
Order allow,deny
</Directory>
</VirtualHost>
That is also if you have it listening on port 80 -- I do not have port 80 open on my firewall, since I just use it on my localhost. You'll of course have to create the directories where ever you put the document root (under /var/www in my case). To test the syntax you can type 'httpd -S' in a terminal (without quotes).

Then you'll want to enter this in your /etc/hosts file for the virtual hosts you create:
Code:
 
127.0.0.1 sitename1.local sitename1
127.0.0.1 sitename2.local sitename2
Then, start or restart the httpd service and pull up the name page (i.e. sitename1.local) and you should see the Apache test page.

Last edited by CiaW; 6th June 2010 at 04:28 AM.
Reply With Quote
  #3  
Old 6th June 2010, 05:32 AM
techmike Offline
Registered User
 
Join Date: Jun 2010
Posts: 8
linuxfedorafirefox
Re: Apache & Virtual Host

you can configure a DNS if u want access from anothers PC differents to you PC. or edit each hosts

you can install webmin a then configure virtual host..
Reply With Quote
  #4  
Old 6th June 2010, 06:00 AM
Firewing1's Avatar
Firewing1 Offline
Administrator
 
Join Date: Dec 2004
Location: Canada
Age: 22
Posts: 9,224
macossafari
Re: Apache & Virtual Host

If you want these site to be accessed externally then you'll want to use something like
Code:
ServerName www.sitename.tld
ServerAlias  sitename.tld
Instead of the .local-style names. Are you going to be hosting your own DNS as well?
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #5  
Old 14th June 2010, 01:48 PM
ssureshot Offline
Registered User
 
Join Date: May 2010
Posts: 38
linuxubuntufirefox
Re: Apache & Virtual Host

Below is one way to do it... I conform to the way it's I guess supposed to be done..
in /etc/apache there are 2 folders.. sites-available and sites-enabled..

Create your virtual hosts in the sites-available then create a link in the sites-enabled.. Follow the below format for the sites...

Quote:
Originally Posted by CiaW View Post
It took me many hours of searching and trying different things to get virtual hosts working for my localhost, see below.

in your httpd.conf file you can add the following to the bottom under the sample virtual host, using your specifics of course in place of 'name':
Code:
<VirtualHost *:80>
    ServerAdmin name@localhost.localdomain  #(or just use root @ localhost if you prefer)
    DocumentRoot /var/www/sitename
    ServerName sitename.local #or whatever you're using
	ServerAlias  sitename
    ErrorLog logs/sitename-error_log
    CustomLog logs/sitename.local-access_log common
<Directory /var/www/sitename>
Options Indexes Includes FollowSymLinks
AllowOverride None
Allow from all
Order allow,deny
</Directory>
</VirtualHost>
That is also if you have it listening on port 80 -- I do not have port 80 open on my firewall, since I just use it on my localhost. You'll of course have to create the directories where ever you put the document root (under /var/www in my case). To test the syntax you can type 'httpd -S' in a terminal (without quotes).

Then you'll want to enter this in your /etc/hosts file for the virtual hosts you create:
Code:
 
127.0.0.1 sitename1.local sitename1
127.0.0.1 sitename2.local sitename2
Then, start or restart the httpd service and pull up the name page (i.e. sitename1.local) and you should see the Apache test page.
Reply With Quote
Reply

Tags
apache, host, virtual

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache virtual host problem reeksy Using Fedora 5 26th May 2008 12:54 AM
apache help, virtual host golpemortal Servers & Networking 1 8th June 2007 07:55 AM
Apache Virtual Host User mattbrown Servers & Networking 5 8th May 2006 08:49 PM
Virtual host problem in apache Fear Servers & Networking 7 24th November 2005 08:54 AM


Current GMT-time: 08:59 (Sunday, 19-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat