Welcome! Log In Create A New Profile

Advanced

Re: error_page

October 11, 2009 07:26PM
не вопрос.

ОС FreeBSD 7.2-p4, nginx - 0.7.62

[b]/usr/local/etc/nginx.conf[/b]
[code]
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;
}
[/code]

[b]/usr/local/etc/nginx/hosts/404.conf[/b]
[code]
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;
}
}
[/code]

и еще пример конфига виртуального хоста (там два html'я и несколько картинок)
[b]/usr/local/etc/nginx/hosts/agro.conf[/b]

[code]
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;
}
}
[/code]

p.s. некоторые думают, что куски конфига, которыми и так "информационное пространство" замусорено излишни.
а вот про ОС и версию nginx , каюсь, стормозил. засыпаю.

http://sarny.net.ua/blogs/mazzy
Subject Author Posted

error_page

mazzy October 11, 2009 06:19PM

Re: error_page

Maxim Dounin October 11, 2009 07:02PM

Re: error_page

mazzy October 11, 2009 07:26PM

Re: error_page

Maxim Dounin October 11, 2009 08:20PM

Re: error_page

mazzy October 11, 2009 08:30PM

Re: error_page

mazzy October 11, 2009 08:39PM

Re: error_page

Maxim Dounin October 11, 2009 09:16PM

Re: error_page

Alexey V. Karagodov October 11, 2009 10:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 172
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready