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 07-10-2013, 03:31 PM   #1
baronobeefdip
Senior Member
 
Registered: Jul 2009
Distribution: Debian Squeeze
Posts: 1,267

Rep: Reputation: 32
Apache custom error pages not working


I have a virtualhost setup and I wanted to make custom error pages for it and only it. I don't want the entire apache server host collection to display these types of error pages. I have my virtualhost setup like this
Code:
<IFModule mod_log_config>
<VirtualHost *:80>
ErrorDocument 404 /crash.html
ServerName joomla.baronobeefdip.josh
DocumentRoot /var/www/html
LogFormat "%v %h %l %u %t \"%r\" %>s %b" joomla.baronobeefdip
CustomLog logs/joomla.baronobeefdip joomla.baronobeefdip
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
</IFModule>
The error document exists in the top level directory in the apache virtual host. I also made sure that I did a chown command on it like so.
Code:
chown apache:apache crash.html
I restarted the apache service and browsed to a page that didn't exist on the server (and tried to access a file that I deleted to get the "not found" error page). When the error page appeared it was the page that apache displays by default. I need help trying to get the custom error pages to work as simple as possible.
 
Old 07-11-2013, 12:15 AM   #2
Linux MR
Member
 
Registered: May 2013
Location: Pacific North West
Distribution: Red Hat, Scientific, Fedora, openSuSE, Mageia, Mint, Arch
Posts: 57

Rep: Reputation: Disabled
I ran into a similar problem recently. It may help to view the log file for apache (mine was /var/log/httpd/{access.log,error.log}).

My issue was that apache was looking for my file starting at the DocumentRoot.
So in my httpd.conf file my DocumentRoot was /var/www/html but I wanted it to look at /var/www/testDir/sample.html

The error log said /var/www/html/testDir/sample.html doesn't exist! I resolved my issue by putting a symbolic/soft link in the /var/www/html to the testDir

Hope that can get you started....or help somehow
 
Old 07-11-2013, 02:03 AM   #3
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
As Linux MR pointed out the ErrorDocument directive if it starts with a / is in relation to the DocumentRoot directive. In your case the file /var/www/html/crash.html would be called on a 404.

How did you restart the apache? I sometime experienced that apache2ctl -k restart does not take all changes in effect. Mostly with rewrite rules. I have to stop and then restart the service.
 
  


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
Squid ReverseProxy: custom error pages with cache_peer_access rather than http_access 4Paul4 Linux - Software 0 11-22-2012 06:44 AM
[SOLVED] Squid custom error pages 4Paul4 Linux - Server 4 06-21-2012 07:03 PM
Apache custom 500 error not showing after php syntax error vockleya Linux - Server 7 08-11-2011 04:42 PM
Apache Error Pages majeztik Linux - Software 2 10-03-2004 07:20 PM
Displaying custom error pages charliecb2 Linux - Newbie 1 03-09-2002 07:20 AM

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

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