Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 25th May 2008, 06:00 PM
reeksy Offline
Registered User
 
Join Date: May 2008
Location: Wiltshire, UK
Posts: 32
Apache virtual host problem

Hi

Im just setting up a development platform on Fedora. I'm stuck whilst trying to set up a Virtual Host outside of the document root (/var/www). Does anyone know how I would achieve this?

Here's my httpd.conf:

Code:
NameVirtualHost *
Listen 80

<VirtualHost *>
   ServerName localhost
   DocumentRoot /var/www/html
</VirtualHost>

<VirtualHost test.local.com>
        ServerName test.local.com
        DocumentRoot /home/jon/www/test.local.com/
        <Directory "/home/jon/www/test.local.com/">
                Options Indexes FollowSymLinks
                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>
Navigating to http://localhost/ works OK, but if i navigate to http://test.local.com/ i receive a 403 error with 'You don't have permission to access / on this server.'

Incidently i've mapped 127.0.0.1 to test.local.com within my /etc/hosts file and /home/jon/www/test.local.com/ has been given 777 permissions! Apache is running as apache:www-data.

Regards,
Jon

Last edited by reeksy; 25th May 2008 at 06:05 PM.
Reply With Quote
  #2  
Old 25th May 2008, 07:44 PM
scottro's Avatar
scottro Offline
Retired Community Manager -- Banned from Texas by popular demand.
 
Join Date: Sep 2007
Location: NYC
Posts: 8,142
I see on a working configuration (in FreeBSD--and I'm not sure if I researched this, or if it was the default), I have

<VirtualHost *:80>
ServerName www.test.local.com:80

DocumentRoot /usr/local/www/testlocal/
<Directory /usr/local/www/testlocal>
AllowOverride None
Order allow,deny
allow from all
Options Indexes FollowSymLinks
</Directory>

So, the main differences that I see are the listing of 80 in the particular VirtualServer directory.

I don't know if that will help or not, but shucks, it's worth a shot till an Apache ace sees this and gives you a more intelligent answer.
Reply With Quote
  #3  
Old 25th May 2008, 09:19 PM
reeksy Offline
Registered User
 
Join Date: May 2008
Location: Wiltshire, UK
Posts: 32
Hi, thanks for the reply.

I've had no luck with this though! I'm still getting permission denied! Any other suggestions!?

Jon
Reply With Quote
  #4  
Old 25th May 2008, 09:48 PM
scottro's Avatar
scottro Offline
Retired Community Manager -- Banned from Texas by popular demand.
 
Join Date: Sep 2007
Location: NYC
Posts: 8,142
The only other things I can think of are the default permissions on the directories and files.

On FreeBSD, the directories owned by root, group wheel 744 permissions and the html files are 644. That's pretty standard, I think. You could try setting up as a non-virtual directory, and if that works, take it from there, but these are just stabs in the dark.
Reply With Quote
  #5  
Old 25th May 2008, 11:07 PM
reeksy Offline
Registered User
 
Join Date: May 2008
Location: Wiltshire, UK
Posts: 32
Awesome! I've cracked it:

Here's the explanation:
By default SELinux will not serve pages from your home directory but it's easy to change the security context of the directory to allow this without turning off SELinux protection for the HTTPD daemon. All commands must be run as root, assuming the folder is called public_html in your home directory:

Code:
$ /usr/sbin/setsebool -P httpd_enable_homedirs 1
$ chcon -R -t httpd_sys_content_t /home/username/public_html
Case closed
Reply With Quote
  #6  
Old 26th May 2008, 12:54 AM
scottro's Avatar
scottro Offline
Retired Community Manager -- Banned from Texas by popular demand.
 
Join Date: Sep 2007
Location: NYC
Posts: 8,142
Good for you. We should have thought of that first.
Reply With Quote
Reply

Tags
apache, host, problem, 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 / Wordpress / Hostname problem timblack Servers & Networking 7 5th November 2008 09:03 AM
apache help, virtual host golpemortal Servers & Networking 1 8th June 2007 07:55 AM
Apache Virtual Host Problem: Can't display the correct page. powereds Servers & Networking 3 10th August 2006 02:43 PM
Virtual host problem in apache Fear Servers & Networking 7 24th November 2005 08:54 AM
FC4, Apache 2.0. Virtual host not working pushback Servers & Networking 1 1st July 2005 01:34 AM


Current GMT-time: 23:24 (Thursday, 23-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