Welcome! Log In Create A New Profile

Advanced

Serving Custom Error Pages

Posted by Khadgar 
Serving Custom Error Pages
May 12, 2012 12:49PM
In Apache to serve custom error pages I did something like so:

<IfModule mod_alias.c>
Alias /foo /web/share/error
<Directory /web/share/error>
Order allow,deny
Allow from all
Options -Indexes
</Directory>
</IfModule>

ErrorDocument 404 /foo/404.html
...

The server root would be something like /web/www.

So if someone typed http://website.com/agasdga and there was nothing there for it the server would display http://website.com/foo/404.html which would in reality be located at /web/share/error/404.html. I've been scratching my head trying to get this to work in nginx. What I have currently is:

error_page 404 /foo/404.html;

server
{
listen 80 default_server;

root /web/www;

location /foo/
{alias /web/share/error;}

...
}



Edited 1 time(s). Last edit at 05/12/2012 12:50PM by Khadgar.
Re: Serving Custom Error Pages
June 25, 2012 01:22PM
hopefully is not to late :) but i guess you figure it out since you didn't replied

server {
listen 80;
server_name x.ro;
root /x/cybernet;
# access_log /x/cybernet/access.log;
error_log /x/cybernet/error.log;

charset utf-8;

location / {
index index.php index.html;
}

# catch all
error_page 404 /index.php;

...

}

so the error_page variable has to be inside server { variable }

http://xDNS.ro && http://xLiST.ro Powered By nginX
Re: Serving Custom Error Pages
June 25, 2012 01:30PM
http://forums.phpfreaks.com/index.php?topic=352513.0

i posted the same issue a while { $ago } but i abandoned the project so that's why the delay
maybe a nginX coder can figure this out because i couldn't

http://xDNS.ro && http://xLiST.ro Powered By nginX
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 120
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready