Showing posts with label front-end. Show all posts
Showing posts with label front-end. Show all posts

Friday, June 27, 2008

Simple HTTP error pages collection

This is collection of following HTTP error pages to show to user instead of regular black-white versions as you get from default Apache HTTP Server or some others.

Client Error 4xx
  • 400 — Bad Request
  • 401 — Unauthorized
  • 403 — Forbidden
  • 404 — Not Found
  • 405 — Method Not Allowed
  • 408 — Request Timeout
  • 410 — Gone
  • 411 — Length Required
  • 412 — Precondition Failed
  • 413 — Request Entity Too Large
  • 414 — Request-URI Too Long
  • 415 — Unsupported Media Type
Server Error 5xx
  • 500 — Internal Server Error
  • 501 — Not Implemented
  • 502 — Bad Gateway
  • 503 — Service Unavailable
You should know, that Apache has build-in support for multi language error pages and mine is not, english only (as for now). It may be important depending on project you are working on.

All you need to do is to replace following patterns:
1) replace your site link

<a href="http://your-site/" title="http://your-site/">Home page</a>

2) and your e-mail and name

<a href="mailto:your-name@your-site" title="Your Name">Web-admin</a>


Now, you need to configure your front-end.

Apache (at httpd.conf or external included in httpd.conf)

ErrorDocument 400 /http_errors/en/400.html
ErrorDocument 401 /http_errors/en/401.html
ErrorDocument 403 /http_errors/en/403.html
ErrorDocument 404 /http_errors/en/404.html
ErrorDocument 405 /http_errors/en/405.html
ErrorDocument 408 /http_errors/en/408.html
ErrorDocument 410 /http_errors/en/410.html
ErrorDocument 411 /http_errors/en/411.html
ErrorDocument 412 /http_errors/en/412.html
ErrorDocument 413 /http_errors/en/413.html
ErrorDocument 414 /http_errors/en/414.html
ErrorDocument 415 /http_errors/en/415.html

ErrorDocument 500 /http_errors/en/500.html
ErrorDocument 501 /http_errors/en/501.html
ErrorDocument 502 /http_errors/en/502.html
ErrorDocument 503 /http_errors/en/503.html
ErrorDocument 506 /http_errors/en/506.html

nginx (at nginx.conf or external included in ginx.conf)

error_page 400 /http_errors/en/400.html;
error_page 401 /http_errors/en/401.html;
error_page 402 /http_errors/en/402.html;
error_page 403 /http_errors/en/403.html;
error_page 404 /http_errors/en/404.html;
error_page 405 /http_errors/en/405.html;
error_page 408 /http_errors/en/408.html;
error_page 410 /http_errors/en/410.html;
error_page 411 /http_errors/en/411.html;
error_page 412 /http_errors/en/412.html;
error_page 413 /http_errors/en/413.html;
error_page 414 /http_errors/en/414.html;
error_page 415 /http_errors/en/415.html;

error_page 500 /http_errors/en/500.html;
error_page 501 /http_errors/en/501.html;
error_page 502 /http_errors/en/502.html;
error_page 503 /http_errors/en/503.html;
error_page 504 /http_errors/en/504.html;


«/http_errors» should be in «DocumentRoot» for this configuration.

Download link:
http errors v1.1.0 (12 KB)

Things TODO:
1) want to make tool, for auto generation of these files and to inject there you name and home page links (probably on Java).
2) need to add some open source license

See also:
Hypertext Transfer Protocol -- HTTP/1.1
Status Code Definitions

Saturday, February 2, 2008

nginx 0.5.35

http://sysoev.ru/nginx/getting_started.html
http://sysoev.ru/nginx/docs/install.html

wget http://sysoev.ru/nginx/nginx-0.5.35.tar.gz
tar xzvf nginx-0.5.35.tar.gz

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-7.6.tar.bz2
wget http://heanet.dl.sourceforge.net/sourceforge/pcre/pcre-7.6.tar.bz2
tar xjvf pcre-7.6.tar.bz2

wget http://www.zlib.net/zlib-1.2.3.tar.bz2
tar xjvf zlib-1.2.3.tar.bz2

wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar xzvf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
/usr/local/httpd/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
cd ..

cd nginx-0.5.35
make clean
./configure --with-zlib=../zlib-1.2.3 --with-pcre=../pcre-7.6
make -j4
make install



/usr/local/nginx/sbin/nginx -V
/usr/local/nginx/sbin/nginx
ps ax -o pid,ppid,user,%cpu,vsz,wchan,command|egrep '(nginx|PID)'

cat /usr/local/nginx/conf/nginx.conf

Saturday, September 15, 2007

make nginx (command-line)

help resources:
getting started
install

getting all sorces:
wget http://sysoev.ru/nginx/nginx-0.5.31.tar.gz
tar xzvf nginx-0.5.31.tar.gz

wget http://ovh.dl.sourceforge.net/sourceforge/pcre/pcre-7.3.tar.bz2
tar xjvf pcre-7.3.tar.bz2

wget http://www.zlib.net/zlib-1.2.3.tar.bz2
tar xjvf zlib-1.2.3.tar.bz2

wget http://stderr.net/apache/rpaf/download/mod_rpaf-0.5.tar.gz
tar xzvf mod_rpaf-0.5.tar.gz

this is for transferring IP address of user to backend.
/usr/local/httpd/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c

cd nginx-0.5.31
make clean
./configure --with-zlib=../zlib-1.2.3 --with-pcre=../pcre-7.3
make -j4
make install

frontend + backend = nginx + apache

hi! this weekend was a bit hot for me, cause i decided to implement Front-end and back-end architecture on my home server (my home machine is, usually, platform for many tests about performance or new technology stuff, that i after use at work).

so i wanted it. and i decided that it will be nginx as front, and my old friend apache as back.

why nginx? i saw that many internet projects i track in my day job (especially at .ru zone) uses it. one thing that i want to mention, that it not so many docs in english, but you always can ask somebody.

very useful was getting started from nginx's author. but it's not always enough - Using Nginx As Reverse-Proxy Server On High-Loaded Sites (russian version) and Заметки о ipb, apache, nginx can solve you too.

after day and a half, i win ;-) and now i has tuned nginx+apache for my 4 virtual hosts. in next article, i will post about install process (and probably after tuning).