I have installed Nginx for a small web server with static content. It
works fine but the site error log file is always empty. All errors such
as 404 are written to the access log only. File grants are the same for
access and error logs.
I’ve tried to change error_log param from “error” to “warn” and that
didn’t help. But changing it to “debug” was successful: log was filled
with debug info (but no error info).
My config files:
/etc/nginx/nginx.conf:
user www;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable “msie6”;
gzip_min_length 200;
gzip_types text/plain text/css application/json
application/x-javascript text/xml application/xml application/xml+rss
text/javascript application/rdf+xml;
include/etc/nginx/conf.d/.conf; # None
include/etc/nginx/sites-enabled/; # One
}
/etc/nginx/sites-available/mysite.conf:
server {
listen 80;
root /var/www/mysite;
index index.html index.htm;
server_name mysite.org;
access_log /var/log/nginx/mysite_access.log combined;
error_log /var/log/nginx/mysite_error.log error;
log_subrequest on;
location / {
try_files $uri $uri/ =404;
autoindex off;
}
}