error_page
mazzy
nginx-forum at nginx.us
Mon Oct 12 03:26:21 MSD 2009
не вопрос.
ОС FreeBSD 7.2-p4, nginx - 0.7.62
/usr/local/etc/nginx.conf
user www www;
worker_processes 2;
error_log /var/log/httpd/nginx.error;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/httpd/nginx.access main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
error_page 404 http://404.sarny.net.ua;
gzip on;
gzip_comp_level 9;
gzip_min_length 2048;
gzip_proxied any;
gzip_types text/plain text/css application/x-httpd-php application/x-javascript application/xml;
include hosts/*.conf;
}
/usr/local/etc/nginx/hosts/404.conf
server {
listen 80;
server_name 404.sarny.net.ua;
root /usr/local/www/404;
index index.php;
access_log /var/log/httpd/404.access main;
#error_page 404 http://404.sarny.net.ua;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
location / {
root /usr/local/etc/www/404;
index index.php;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/404$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
и еще пример конфига виртуального хоста (там два html'я и несколько картинок)
/usr/local/etc/nginx/hosts/agro.conf
server {
listen 80;
server_name agro.sarny.net.ua www.agro.sarny.net.ua;
root /usr/local/www/hosting/agro;
index index.htm;
access_log /var/log/httpd/agro.sarny.net.ua.access main;
#error_page 404 http://404.sarny.net.ua/
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
break;
}
location ~ /\.ht {
deny all;
}
}
p.s. некоторые думают, что куски конфига, которыми и так "информационное пространство" замусорено излишни.
а вот про ОС и версию nginx , каюсь, стормозил. засыпаю.
Posted at Nginx Forum: http://forum.nginx.org/read.php?21,12986,13001#msg-13001
More information about the nginx-ru
mailing list