LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-18-2009, 12:48 PM   #1
thobson
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Rep: Reputation: 0
403 error on name virtual host


Could someone please have a quick look through my config and see if they notice any obvious errors. I've set up several virtual hosts before without issue but I've screwed this one up and I can't see anything wrong ... it's been a long day though!

Code:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "/home/ubersmith/public/www"
ServerName ubersmith.raptorcommerce.com
<Directory "/home/ubersmith/public/www">
allow from all
Options -Indexes
AllowOverride All
</Directory>
</VirtualHost>

$ sudo /usr/sbin/apachectl configtest
Syntax OK

$ pwd
/home/ubersmith

$ ls -l
drwxrwx--- 3 ubersmith apache 4096 Aug 18 16:07 public

$ cd public
$ ls -l 
drwxrwx--- 2 ubersmith apache 4096 Aug 18 16:55 www

$ cd www
$ ls -l
-rwxrwx--- 1 ubersmith apache 5 Aug 18 16:24 test.txt
When I hit http://ubersmith.raptorcommerce.com/test.txt I get a 403 error

I'd be very grateful for a second pair of eyes!

Toby
 
Old 08-18-2009, 01:07 PM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by thobson View Post
Could someone please have a quick look through my config and see if they notice any obvious errors. I've set up several virtual hosts before without issue but I've screwed this one up and I can't see anything wrong ... it's been a long day though!

Code:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "/home/ubersmith/public/www"
ServerName ubersmith.raptorcommerce.com
<Directory "/home/ubersmith/public/www">
allow from all
Options -Indexes
AllowOverride All
</Directory>
</VirtualHost>

$ sudo /usr/sbin/apachectl configtest
Syntax OK

$ pwd
/home/ubersmith

$ ls -l
drwxrwx--- 3 ubersmith apache 4096 Aug 18 16:07 public

$ cd public
$ ls -l 
drwxrwx--- 2 ubersmith apache 4096 Aug 18 16:55 www

$ cd www
$ ls -l
-rwxrwx--- 1 ubersmith apache 5 Aug 18 16:24 test.txt
When I hit http://ubersmith.raptorcommerce.com/test.txt I get a 403 error

I'd be very grateful for a second pair of eyes!

Toby

paste the error here
 
Old 08-18-2009, 04:54 PM   #3
lmpmbernardo
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
is your home directory searchable by apache? what do you get with ls -l /home/?
 
Old 08-18-2009, 05:31 PM   #4
thobson
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lmpmbernardo View Post
is your home directory searchable by apache? what do you get with ls -l /home/?
That was it! I knew it was something simple! thanks lmpmbernardo :-)
 
Old 09-28-2009, 11:34 PM   #5
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Rep: Reputation: 31
what should you get with ls -l /home ?

how can you make it searchable for apache?

i have the same problem... i chmod 777'ed /home/user/site/index.html and that did not work...
 
Old 09-29-2009, 04:04 AM   #6
chandramani_yadav
Member
 
Registered: Jan 2007
Location: Vienna
Distribution: Redhat
Posts: 47

Rep: Reputation: 19
Accroding to me something missing here
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "/home/ubersmith/public/www"
ServerName ubersmith.raptorcommerce.com
<Directory "/home/ubersmith/public/www">
allow from all
Options -Indexes
AllowOverride All
</Directory>
</VirtualHost>


it should be like this

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "/home/ubersmith/public/www"
ServerName ubersmith.raptorcommerce.com
<Directory "/home/ubersmith/public/www">
Options -Indexes
Order Deny,Allow
Deny from all
allow from all
</Directory>
</VirtualHost>

check that you have 755 permission on your /home directory.
it will work.
 
Old 09-30-2009, 03:39 AM   #7
lmpmbernardo
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
all the directories up to your document root need to be readable (r) and searchable (or executable, x) by apache. so chmod a+x /home/user/site is not enough if the same is not done to /home/user.
 
Old 09-30-2009, 08:29 AM   #8
thobson
LQ Newbie
 
Registered: Aug 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lmpmbernardo View Post
all the directories up to your document root need to be readable (r) and searchable (or executable, x) by apache. so chmod a+x /home/user/site is not enough if the same is not done to /home/user.
yeah thats what caught me out ... I forgot that every directory needs to be readable by apache including the parent dirs
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Apache and Named Virtual Hosts Giving 403 Forbidden Error PekinSOFT Linux - Server 2 04-15-2009 01:07 AM
Apache2 under Ubuntu - Virtual Host error on restart MJWhiteDerm Linux - Server 10 09-23-2007 07:36 PM
HTTPD Virtual Host limit forbidden error, how to increase? norbul Linux - Software 1 05-11-2006 05:59 AM
Apache2 virtual host cgi 403 Forbidden / mossy Linux - Software 15 07-27-2005 04:56 PM
403 Forbidden on Virtual Servers with PHP scripts tonyboy Linux - Software 3 03-11-2004 10:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:50 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