nginx logging conundrum

Mike L jackoroses at
Tue Aug 9 05:30:49 UTC 2011

I need some enlightenment from some savants here.
My issue is I can't seem to get logging to work besides logging to
/var/log/messages. I originally installed the non-devel port on freebsd 8.2,
which actually logged to nginx-error.log for a little, until I started
tweaking the config file more to my setup. I originally intended to override
the log path compile options in the config file by pointing to
/var/log/www/nginx-access.log I never was able to get any logging to this
file though. So I went back to having the path in the config file match the
compile options - /var/log/nginx-access.log
Still no logging to this file and no files created. So I touched the files
thinking maybe.. That didn't work and than I did a chmod/chown on the files
hoping that was the issue. Still no logging and by this time no errors
logging either. I only get the output in messages.
I have done a lsof looking to see if any files are open yet I'm not too
"bright" and didn't see any output showing logging.
I've looked at my syslog.conf/newsyslog.conf and didn't see any help there.
I've attempted to have both global and server log configurations and neither
seem to do anything for me currently.
 I am currently running nginx -V
nginx: nginx version: nginx/1.1.0
nginx: TLS SNI support enabled
nginx: configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I
/usr/local/include' --with-ld-opt='-L /usr/local/lib'
--sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/
--error-log-path=/var/log/nginx-error.log --user=www --group=www
--with-file-aio --with-ipv6
--with-http_flv_module --with-http_geoip_module
--with-http_gzip_static_module --with-http_image_filter_module
--with-http_perl_module --with-http_realip_module --with-http_ssl_module
--with-pcre --with-syslog --with-syslog-facility=LOG_DAEMON

My .conf file which probably has other issues with it as well. As I
mentioned I have attempted several different paths for loggin in this config
file and tried to remove paths to see if that made any difference.
user  www www;
worker_processes  1;

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/nginx-access.log main;
        sendfile        on;
        tcp_nopush     on;
        tcp_nodelay      on;
        #keepalive_timeout  0;
        keepalive_timeout  65;
        gzip  on;
        gzip_static on;
        gzip_buffers 16 8k;
        gzip_comp_level 6;
        gzip_http_version 1.0;
        gzip_types text/plain text/css image/x-icon image/bmp;
        gzip_vary         on;
        gzip_min_length  1100;

server {
        listen 80;
        listen 443 ssl;
        root /usr/local/www/crafty;
        index  index.php index.html index.htm;
        ssl_certificate    /usr/local/etc/ssl/server.crt;
        ssl_certificate_key  /usr/local/etc/ssl/server.key;
        ssl_session_timeout  5m;
        ssl_protocols  SSLv2 SSLv3 TLSv1;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers   on;
        access_log  /var/log/ combined;
        error_log /var/log/nginx-error.log error;

        location ~ \.htaccess {
                deny all;

        location / {
                if (!-e $request_filename) {
                        rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2
/index.php?$1=$2.$3&$4=$5&$6 last;
/index.php?$1=$2.$3&$4=$5 last;
/index.php?$1=$2.$3&$4&$5 last;
^/index\.php/([a-z]+),([0-9]+)\.(\w+)/(\w+)\.html /index.php?$1=$2.$3&$4
^/index\.php/([a-z]+),([0-9]+)/(\w+),(\w+)\.html /index.php?$1=$2&$3=$4
                        rewrite ^/index\.php/([a-z]+),([0-9]+)\.(\w+)\.html
/index.php?$1=$2.$3 last;
                if ($uri ~* "\.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$") {
                        expires max;
                error_page  404              /404.html;
        location = /404.html {
                root    /usr/local/www/crafty;
        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/crafty;


        location ~* \.php$ {
                if (!-e $request_filename) {
                        return 404;
                root /usr/local/www/crafty;
                include /usr/local/etc/nginx/fastcgi_params;
                #if ($uri !~ "^/images/") {
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME


my google powers have let me down and the only thing I have found in
searching on this is issues with past versions but nothing for current.
I have tried all methods of stopping/starting the daemon. From using the
rc.d script to pkill to calling the binary -s to rebooting the server.
I'm at a lost right now, I thought a reinstall of devel would help but I'm
at the same place I was 30 hours ago.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list