Answer the question
In order to leave comments, you need to log in
How to keep separate nginx error logs for virtual hosts?
It is required to set up a separate nginx error log for each virtual host.
FreeBSD 9.1 system
Nginx 1.2.4 works as front-end to Apache2.2
nginx -V:
nginx version: nginx/1.2.4
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx-error.log --user=www --group=www --with-ipv6 --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx-access.log --with-http_stub_status_module --with-pcre
worker_processes 32;
events {
worker_connections 1024;
use kqueue;
}
http {
client_max_body_size 10m;
include mime.types;
include ipblock.conf;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 5;
gzip on;
gzip_proxied any;
gzip_comp_level 5;
gzip_min_length 1024;
gzip_types text/css text/plain text/json text/x-js text/javascript text/xml application/json application/x-javascript application/xml application/xml+rss application/javascript;
gzip_http_version 1.0;
gzip_disable "msie6";
gzip_vary on;
server {
listen 80;
server_name ~^(www\.)?(?<domain>.+)$;
charset utf-8;
access_log /var/log/nginx/$host-access.log;
error_log /var/log/nginx/$host-error.log error;
if ($http_user_agent ~* 2gis) {
return 444;
}
location / {
error_page 412 = @dynamic;
if ($request_method = 'POST') {return 412;}
if ($is_args = '?') {return 412;}
if ($cookie_umicms_session) {return 412;}
try_files $uri/index.html @dynamic;
root /usr/local/www/apache22/cache;
index index.php;
}
location @dynamic {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://185.11.244.233:81;
}
location ~* ^/admin {
error_page 412 = @dynamic;
return 412;
}
location ~* \.php$ {
error_page 412 = @dynamic;
return 412;
}
location ~* /ulang/ {
error_page 412 = @dynamic;
return 412;
}
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|bmp|rtf|js|otf|svg|eot|woff)$ {
root /usr/local/www/apache22/vhosts/$domain;
access_log off;
expires 7d;
}
location ~* (config\.ini|install\.ini|install\.log|umi\.nginx\.conf|dbview\.php|umibackup) {
rewrite ^(.*)$ / permanent;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}
proxy_read_timeout 900;
client_header_timeout 10m;
client_body_timeout 10m;
send_timeout 10m;
}
}
access_log /var/log/nginx/$host-access.log;
error_log /var/log/nginx/$host-error.log error;
Answer the question
In order to leave comments, you need to log in
In general, I googled that this is impossible.
trac.nginx.org/nginx/ticket/57
=(
1. You can pervert manually.
2. You can send to syslog, and syslog itself will sort by name.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question