LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 06-28-2009, 02:47 PM   #1
jerod23
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Rep: Reputation: 0
Yet another Apache index.html 403 problem


I'm migrating from a shared server environment to a VPS. The VPS is running Apache 2.0 under CentOS. Right now the VPS has just an IP address.

Before moving all of the files over I wanted to run a small test. I brought the three files that comprise the home page of my domain, including one named index.html Then it's the usual story, I still see the CentOS Apache 2 Test page.

All three files are in /var/www/html
The permissions for the files are 0644 and 0755 for the directories.
The user apache owns everything.

From /etc/httpd/conf/httpd.conf:

Quote:
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
# The index.html.var file (a type-map) is used to deliver content-
# negotiated documents. The MultiViews Option can be used for the
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.shtml index.html.var index.php index.htm
DocumentRoot had originally been set to another directory for the domain name and not the IP address within <VirtualHost>, but changing that so they are both /var/www/html makes no difference.

The error log shows this:

Quote:
(13)Permission denied: access to /index.php denied
(13)Permission denied: access to /index.html denied
(13)Permission denied: access to /index.shtml denied
(13)Permission denied: access to /index.html.var denied
No mention of index.htm When I tried using index.htm it still didn't work.

Explicitly using http://xxx.xx.xxx.xxx/index.html brings up the standard 403 page.

Setting the file and directory permissions to 0777 makes no difference. Creating a php version of index.html doesn't work.

I've even tried using .htaccess to define index.html as the default file. The existence of an empty .htaccess file made no difference either.

The really odd thing is when I changed the welcome.conf file. I commented out every line and still get the CentOS test page.

I'm sure it has to be something really freaking obvious that I'm missing.
 
Old 06-28-2009, 03:34 PM   #2
jhcaiced
Member
 
Registered: Mar 2009
Distribution: CentOS - Ubuntu - Debian
Posts: 83

Rep: Reputation: 27
Hi,

I do a small test in my CentOS + Apache server and the only
way that i can duplicate the messages you are getting in the
log is when I intentionally did:
chmod 700 /var/www/html

After that, i got the default Centos Test Page and messages
like yours in the log.
(13)Permission denied: access to /index.php denied
(13)Permission denied: access to /index.html denied
(13)Permission denied: access to /index.html.var denied

Attempting to access http://127.0.0.1/index.htm gives me
a 403 Forbidden page.

After restoring the permissions with "chmod 755 /var/www/html"
everything works fine.

Another thing I noticed is that you should add index.htm
to the DirectoryIndex in httpd.conf

Another test, when I do chmod 700 /var/www the message in log
is :
(13)Permission denied: access to / denied
And the browser shows a 403 Forbidden page.

Hope it helps with your trouble.

Best regards,
 
1 members found this post helpful.
Old 06-28-2009, 03:51 PM   #3
jerod23
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jhcaiced View Post

I do a small test in my CentOS + Apache server and the only
way that i can duplicate the messages you are getting in the
log is when I intentionally did:
chmod 700 /var/www/html

After that, i got the default Centos Test Page and messages
like yours in the log.
(13)Permission denied: access to /index.php denied
(13)Permission denied: access to /index.html denied
(13)Permission denied: access to /index.html.var denied

Attempting to access http://127.0.0.1/index.htm gives me
a 403 Forbidden page.
I get those messages with the directory permissions set at 755 or 777.

Quote:
Originally Posted by jhcaiced View Post

Another thing I noticed is that you should add index.htm
to the DirectoryIndex in httpd.conf
I have that entry. It's odd to me that there is no permission denied message for index.htm whether or not index.htm exists.


Quote:
Originally Posted by jhcaiced View Post
Another test, when I do chmod 700 /var/www the message in log
is :
(13)Permission denied: access to / denied
And the browser shows a 403 Forbidden page.
No permission denied message for / is in any of the logs.

Thanks for running the test.
 
Old 06-28-2009, 04:03 PM   #4
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
What happens if you try without SELinux (setenforce 0)

Security context for /var/www/html should be given by
Quote:
# ls -lZd /var/www/html
drwxr-xr-x root root system_u:object_r:httpd_sys_content_t /var/www/html
 
Old 06-28-2009, 04:18 PM   #5
jerod23
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by billymayday View Post
What happens if you try without SELinux (setenforce 0)

Security context for /var/www/html should be given by
I'm not running SELinux.

Although as I've already had four or five different people attempt to crack the server since it came online I probably should.
 
Old 06-30-2009, 11:29 AM   #6
jerod23
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
I guess I've stumped everyone.

Along the same lines of chmod 777, other things I've tried to no avail. In no particular order:

Commenting out the VirtualHost with the actual domain name that is going to be used, and leaving the one with the IP address.

Using the ServerName with the IP address and port 80 along. UseCanonicalName is set to On.

I removed the quotes from directories as some Apache documentation I read didn't use them. When that didn't make any difference I put them back.

Explicitly defining Options +Indexes +FollowSymLinks +ExecCGI instead of just Options Indexes etc.
 
Old 06-30-2009, 01:27 PM   #7
jerod23
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jerod23 View Post
The really odd thing is when I changed the welcome.conf file. I commented out every line and still get the CentOS test page.
That was specious. I forgot to stop and restart Apache a couple of times. It wouldn't have mattered much, as it still wasn't happy with the changes I made.

I did find what it wanted.

Quote:
#
# Use name-based virtual hosting.
#

NameVirtualHost xxx.xx.xxx.xxx:80
So the IP address is name-based. OK then.

It's happy with both the named domain and the IP address as virtual host entries.

It doesn't like something in my .htaccess file, but that's easy enough to figure out.
 
Old 06-30-2009, 04:41 PM   #8
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
So are you still getting http 403 errors?

Your <Directory> stanza needs to contain something along the lines of:
Code:
Order Deny,Allow
Deny from all
Allow from some.ip.here
Allow from some.host.here
 
Old 07-01-2009, 11:23 AM   #9
jerod23
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by anomie View Post
So are you still getting http 403 errors?
Nope. The static html files are displaying as expected. Next up: moving Invision Power Board from the current server to the new one.

Quote:
Originally Posted by anomie View Post
Your <Directory> stanza needs to contain something along the lines of:
Code:
Order Deny,Allow
Deny from all
Allow from some.ip.here
Allow from some.host.here
I should have included that in my original post. / is deny from all and /var/www/html is allow from all. Something like that. I'm posting from my laptop and I don't have a telnet or ftp client installed.

Also it's the .htaccess file with the entries for IPB that Apache currently doesn't like, but that's no big deal. Once IPB is installed I expect it will like the .htaccess file, there will be no problem anywhere, my teeth will be bright and world peace will finally be achieved.
 
Old 07-13-2009, 01:23 PM   #10
jerod23
LQ Newbie
 
Registered: Jun 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Just a coda for anyone else who finds themselves in a similar situation.

My domain host uses Plex to partition the physical server into multiple virtual servers, and Plex has its own way of doing things. E.g. instead of /var/www/html being the default location for the web-accessible files it's /var/www/vhosts/yourdomain.tld/httpdocs/

The Virtual Host stanza takes about a screen and a half. Without comments or blank lines. For a single virtual host entry. So that's three screens worth for the domain name and the IP address.

I had loads of fun getting IPB to work, MySQL had to be reinstalled and phpMyAdmin still doesn't work, but Apache hasn't been any trouble since.
 
  


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 index.html doesn't show up but index.php do zoffmann Linux - Server 5 01-28-2008 03:53 PM
httpd 403 forbidden index.html question Amuro-Ray2020 Linux - Server 1 07-11-2007 07:00 PM
403 You don't have permission to access /index.html on this server. xpucto Linux - Networking 6 06-06-2006 09:19 AM
Apache problem - cannot get index.html file to show nebloof Linux - Software 3 01-15-2005 10:32 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration