Welcome! Log In Create A New Profile

Advanced

Issue with variables in access_log and error_log

dale gallagher
July 29, 2009 01:30PM
Hi there

I'm running nginx 0.7.61 on Linux. Using spawn-fcgi under damontools
which runs under a separate uid per virtual host and creates a socket
/var/run/php/$domain/socket

I've configured nginx as per the config below. Everything works well,
but including variables in access_log and error_log give the error:

[emerg]: open() "/usr/$webroot/$domain/log/error.log" failed (2: No such
file or directory)

This seems to indicate that the variables aren't being expanded
properly? In particular, the prepended '/usr' part must be from the
--prefix definition when building nginx???

nginx runs as user 'www' which has write access to each of the
/var/www/$domain/log directories (by group ownership and 770 perms).

Any pointers would be appreciated.

Thanks
Dale

----- config -----

user www;
.....
..
http {
...
server {
listen 80;

server_name _;
server_name_in_redirect off;

set $webroot /var/www;

set $domain $host;
if ($domain ~ "^(w{3}\.)?(.*)") {
set $domain $2;
}

access_log $webroot/$domain/log/access.log;
error_log $webroot/$domain/log/error.log error;

root $webroot/$domain/public;

location / {
index index.html index.php index.php4 dispatch.fcgi index.cgi;
try_files $uri $uri/ @wordpress;
}
# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html)$ {
expires 30d;
}
location ~* \.(ht|conf$|db$|lib$|cfg$|inc$|bak$) {
deny all;
}
location ~ \.php$ {
try_files $uri @wordpress;
fastcgi_pass unix:/var/run/php/$domain/socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location @wordpress {
fastcgi_pass unix:/var/run/php/$domain/socket;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
}
}
}
Subject Author Posted

Issue with variables in access_log and error_log

dale gallagher July 29, 2009 01:30PM

Re: Issue with variables in access_log and error_log

Maxim Dounin July 29, 2009 01:54PM

Re: Issue with variables in access_log and error_log

Dale Gallagher July 29, 2009 01:55PM

Re: Issue with variables in access_log and error_log

Igor Sysoev July 29, 2009 02:41PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 169
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