Hi,
I recently upgraded to nginx 0.8.53 as it has support for regular
expressions in the server_name directive.
However, when using this, the index directive gets ignored and a
directory listing is displayed.
I’ve included part of the file which is causing the problem below.
Essentially, when I visit a host matched by the server_name, I get a
directory listing. One of the files in the directory is index.php -
which is set as one of the “indexes”.
Has anyone experienced similar issues to this?
server {
server_name ~^staging-(?P.+).(?P.+).com$;
root
/var/www/htdocs/site1/staging/$domain-staging-$version/public/;
autoindex on;
error_log /var/log/nginx/site1-staging.error.log info
index index.php index.html index.htm;
# file continues.....
Posted at Nginx Forum:
Hi, I recently upgraded to nginx 0.8.53 as it has support for regular expressions in the server_name directive. However, when using this, the index directive gets ignored and a directory listing is displayed. I've included part of the file which is...
eckstac
December 14, 2010, 12:51pm
2
On Tue, Dec 14, 2010 at 06:23:36AM -0500, eckstac wrote:
directory listing. One of the files in the directory is index.php -
error_log /var/log/nginx/site1-staging.error.log info
index index.php index.html index.htm;
# file continues.....
Could you create a debug log:
http://nginx.org/en/docs/debugging_log.html
–
Igor S.
http://sysoev.ru/en/
eckstac
December 14, 2010, 1:40pm
3
See below. It appears to be trying for index.html in that directory, but
not index.php
2010/12/14 12:17:27 [debug] 12393#0: *1 event timer del: 3: 3838918494
2010/12/14 12:17:27 [debug] 12393#0: *1 generic phase: 0
2010/12/14 12:17:27 [debug] 12393#0: *1 rewrite phase: 1
2010/12/14 12:17:27 [debug] 12393#0: *1 test location: "/"
2010/12/14 12:17:27 [debug] 12393#0: *1 test location: ~ "\.php$"
2010/12/14 12:17:27 [debug] 12393#0: *1 test location: ~
"^/sites/.*/files/imagecache/"
2010/12/14 12:17:27 [debug] 12393#0: *1 test location: ~
"\.(js|css|png|jpg|jpeg|gif|ico|pdf)$"
2010/12/14 12:17:27 [debug] 12393#0: *1 using configuration "/"
2010/12/14 12:17:27 [debug] 12393#0: *1 http cl:-1 max:1048576
2010/12/14 12:17:27 [debug] 12393#0: *1 rewrite phase: 3
2010/12/14 12:17:27 [debug] 12393#0: *1 post rewrite phase: 4
2010/12/14 12:17:27 [debug] 12393#0: *1 generic phase: 5
2010/12/14 12:17:27 [debug] 12393#0: *1 generic phase: 6
2010/12/14 12:17:27 [debug] 12393#0: *1 generic phase: 7
2010/12/14 12:17:27 [debug] 12393#0: *1 access phase: 8
2010/12/14 12:17:27 [debug] 12393#0: *1 access phase: 9
2010/12/14 12:17:27 [debug] 12393#0: *1 post access phase: 10
2010/12/14 12:17:27 [debug] 12393#0: *1 try files phase: 11
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy:
"/var/www/htdocs/pressflow/staging/"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var:
"topuniversities"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy: "-staging-"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var: "content"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy: "/public"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var: "/"
2010/12/14 12:17:27 [debug] 12393#0: *1 try to use file: "/"
"/var/www/htdocs/pressflow/staging/topuniversities-staging-content/public/"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var: "/"
2010/12/14 12:17:27 [debug] 12393#0: *1 try to use dir: "/"
"/var/www/htdocs/pressflow/staging/topuniversities-staging-content/public/"
2010/12/14 12:17:27 [debug] 12393#0: *1 try file uri: "/"
2010/12/14 12:17:27 [debug] 12393#0: *1 content phase: 12
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy:
"/var/www/htdocs/pressflow/staging/"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var:
"topuniversities"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy: "-staging-"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var: "content"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy: "/public"
2010/12/14 12:17:27 [debug] 12393#0: *1 open index
"/var/www/htdocs/pressflow/staging/topuniversities-staging-content/public/index.html"
2010/12/14 12:17:27 [debug] 12393#0: *1 stat()
"/var/www/htdocs/pressflow/staging/topuniversities-staging-content/public/index.html"
failed (2: No such file
or directory)
2010/12/14 12:17:27 [debug] 12393#0: *1 http index check dir:
"/var/www/htdocs/pressflow/staging/topuniversities-staging-content/public"
2010/12/14 12:17:27 [debug] 12393#0: *1 content phase: 13
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy:
"/var/www/htdocs/pressflow/staging/"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var:
"topuniversities"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy: "-staging-"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var: "content"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy: "/public"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex:
"/var/www/htdocs/pressflow/staging/topuniversities-staging-content/public"
2010/12/14 12:17:27 [debug] 12393#0: *1 xslt filter header
2010/12/14 12:17:27 [debug] 12393#0: *1 HTTP/1.1 200 OK
Server: nginx/0.8.53
Date: Tue, 14 Dec 2010 12:17:27 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Content-Encoding: gzip
2010/12/14 12:17:27 [debug] 12393#0: *1 write new buf t:1 f:0 08BD0AE0,
pos 08BD0AE0, size: 179 file: 0, size: 0
2010/12/14 12:17:27 [debug] 12393#0: *1 http write filter: l:0 f:0
s:179
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "includes"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file:
"install.php"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "scripts"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file:
"xmlrpc.php"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "cron.php"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file:
".htaccess"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "sites"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file:
"index.php"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "."
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "profiles"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file:
"update.php"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: ".."
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file:
"cron-all.php"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "modules"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "themes"
2010/12/14 12:17:27 [debug] 12393#0: *1 http autoindex file: "misc"
2010/12/14 12:17:27 [debug] 12393#0: *1 posix_memalign: 08BD0E10:4096
@16
2010/12/14 12:17:27 [debug] 12393#0: *1 http output filter "/?"
2010/12/14 12:17:27 [debug] 12393#0: *1 http copy filter: "/?"
2010/12/14 12:17:27 [debug] 12393#0: *1 image filter
2010/12/14 12:17:27 [debug] 12393#0: *1 xslt filter body
2010/12/14 12:17:27 [debug] 12393#0: *1 http postpone filter "/?"
BF9D74EC
2010/12/14 12:17:27 [debug] 12393#0: *1 http gzip filter
2010/12/14 12:17:27 [debug] 12393#0: *1 malloc: B6E76008:270336
2010/12/14 12:17:27 [debug] 12393#0: *1 gzip alloc: n:1 s:5828 a:8192
p:B6E76008
2010/12/14 12:17:27 [debug] 12393#0: *1 gzip alloc: n:32768 s:2 a:65536
p:B6E78008
2010/12/14 12:17:27 [debug] 12393#0: *1 gzip alloc: n:32768 s:2 a:65536
p:B6E88008
2010/12/14 12:17:27 [debug] 12393#0: *1 gzip alloc: n:32768 s:2 a:65536
p:B6E98008
2010/12/14 12:17:27 [debug] 12393#0: *1 gzip alloc: n:16384 s:4 a:65536
p:B6EA8008
2010/12/14 12:17:27 [debug] 12393#0: *1 gzip in: 08BD0C88
2010/12/14 12:17:27 [debug] 12393#0: *1 gzip in_buf:08BD0C14 ni:08BD0E20
ai:1628
2010/12/14 12:17:27 [debug] 12393#0: *1 malloc: 08B9B6C0:4096
2010/12/14 12:17:27 [debug] 12393#0: *1 deflate in: ni:08BD0E20
no:08B9B6C0 ai:1628 ao:4096 fl:4 redo:0
2010/12/14 12:17:27 [debug] 12393#0: *1 deflate out: ni:08BD147C
no:08B9B823 ai:0 ao:3741 rc:1
2010/12/14 12:17:27 [debug] 12393#0: *1 gzip in_buf:08BD0C14
pos:08BD0E20
2010/12/14 12:17:27 [debug] 12393#0: *1 free: B6E76008
2010/12/14 12:17:27 [debug] 12393#0: *1 http chunk: 10
2010/12/14 12:17:27 [debug] 12393#0: *1 http chunk: 363
2010/12/14 12:17:27 [debug] 12393#0: *1 write old buf t:1 f:0 08BD0AE0,
pos 08BD0AE0, size: 179 file: 0, size: 0
2010/12/14 12:17:27 [debug] 12393#0: *1 write new buf t:1 f:0 00000000,
pos 08BD0D54, size: 5 file: 0, size: 0
2010/12/14 12:17:27 [debug] 12393#0: *1 write new buf t:0 f:0 00000000,
pos 080E3E04, size: 10 file: 0, size: 0
2010/12/14 12:17:27 [debug] 12393#0: *1 write new buf t:1 f:0 08B9B6C0,
pos 08B9B6C0, size: 363 file: 0, size: 0
2010/12/14 12:17:27 [debug] 12393#0: *1 write new buf t:0 f:0 00000000,
pos 080D66DC, size: 7 file: 0, size: 0
2010/12/14 12:17:27 [debug] 12393#0: *1 http write filter: l:1 f:1
s:564
2010/12/14 12:17:27 [debug] 12393#0: *1 http write filter limit 0
2010/12/14 12:17:27 [debug] 12393#0: *1 writev: 564
2010/12/14 12:17:27 [debug] 12393#0: *1 http write filter 00000000
2010/12/14 12:17:27 [debug] 12393#0: *1 http copy filter: 0 "/?"
2010/12/14 12:17:27 [debug] 12393#0: *1 http finalize request: 0, "/?"
a:1, c:1
2010/12/14 12:17:27 [debug] 12393#0: *1 set http keepalive handler
2010/12/14 12:17:27 [debug] 12393#0: *1 http close request
2010/12/14 12:17:27 [debug] 12393#0: *1 http log handler
2010/12/14 12:17:27 [debug] 12393#0: *1 free: 08B9B6C0
2010/12/14 12:17:27 [debug] 12393#0: *1 free: 00000000
2010/12/14 12:17:27 [debug] 12393#0: *1 free: 08BCFDE0, unused: 36
2010/12/14 12:17:27 [debug] 12393#0: *1 free: 08BD0E10, unused: 2187
2010/12/14 12:17:27 [debug] 12393#0: *1 event timer add: 3:
65000:3838923501
2010/12/14 12:17:27 [debug] 12393#0: *1 free: 08B96A10
2010/12/14 12:17:27 [debug] 12393#0: *1 free: 08BAD7E0
2010/12/14 12:17:27 [debug] 12393#0: *1 hc free: 00000000 0
2010/12/14 12:17:27 [debug] 12393#0: *1 hc busy: 00000000 0
2010/12/14 12:17:27 [debug] 12393#0: *1 tcp_nodelay
2010/12/14 12:17:27 [debug] 12393#0: *1 post event 08BED678
2010/12/14 12:17:27 [debug] 12393#0: *1 delete posted event 08BED678
2010/12/14 12:17:27 [debug] 12393#0: *1 http keepalive handler
2010/12/14 12:17:27 [debug] 12393#0: *1 malloc: 08B96A10:1024
2010/12/14 12:17:27 [debug] 12393#0: *1 recv: fd:3 -1 of 1024
2010/12/14 12:17:27 [debug] 12393#0: *1 recv() not ready (11: Resource
temporarily unavailable)
2010/12/14 12:17:27 [debug] 12393#0: *1 http keepalive handler
2010/12/14 12:17:27 [debug] 12393#0: *1 recv: fd:3 673 of 1024
2010/12/14 12:17:27 [debug] 12393#0: *1 malloc: 08BAD8E8:676
2010/12/14 12:17:27 [debug] 12393#0: *1 event timer del: 3: 3838923501
2010/12/14 12:17:27 [debug] 12393#0: *1 generic phase: 0
2010/12/14 12:17:27 [debug] 12393#0: *1 rewrite phase: 1
2010/12/14 12:17:27 [debug] 12393#0: *1 test location: "/"
2010/12/14 12:17:27 [debug] 12393#0: *1 test location: "robots.txt"
2010/12/14 12:17:27 [debug] 12393#0: *1 test location: "favicon.ico"
2010/12/14 12:17:27 [debug] 12393#0: *1 using configuration
"=/favicon.ico"
2010/12/14 12:17:27 [debug] 12393#0: *1 http cl:-1 max:1048576
2010/12/14 12:17:27 [debug] 12393#0: *1 rewrite phase: 3
2010/12/14 12:17:27 [debug] 12393#0: *1 post rewrite phase: 4
2010/12/14 12:17:27 [debug] 12393#0: *1 generic phase: 5
2010/12/14 12:17:27 [debug] 12393#0: *1 generic phase: 6
2010/12/14 12:17:27 [debug] 12393#0: *1 generic phase: 7
2010/12/14 12:17:27 [debug] 12393#0: *1 access phase: 8
2010/12/14 12:17:27 [debug] 12393#0: *1 access phase: 9
2010/12/14 12:17:27 [debug] 12393#0: *1 post access phase: 10
2010/12/14 12:17:27 [debug] 12393#0: *1 try files phase: 11
2010/12/14 12:17:27 [debug] 12393#0: *1 content phase: 12
2010/12/14 12:17:27 [debug] 12393#0: *1 content phase: 13
2010/12/14 12:17:27 [debug] 12393#0: *1 content phase: 14
2010/12/14 12:17:27 [debug] 12393#0: *1 content phase: 15
2010/12/14 12:17:27 [debug] 12393#0: *1 content phase: 16
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy:
"/var/www/htdocs/pressflow/staging/"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var:
"topuniversities"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy: "-staging-"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script var: "content"
2010/12/14 12:17:27 [debug] 12393#0: *1 http script copy: "/public"
2010/12/14 12:17:27 [debug] 12393#0: *1 http filename:
"/var/www/htdocs/pressflow/staging/topuniversities-staging-content/public/favicon.ico"
2010/12/14 12:17:27 [debug] 12393#0: *1 add cleanup: 08BD0438
2010/12/14 12:17:27 [debug] 12393#0: *1 http finalize request: 404,
"/favicon.ico?" a:1, c:1
2010/12/14 12:17:27 [debug] 12393#0: *1 http special response: 404,
"/favicon.ico?"
2010/12/14 12:17:27 [debug] 12393#0: *1 http set discard body
2010/12/14 12:17:27 [debug] 12393#0: *1 xslt filter header
2010/12/14 12:17:27 [debug] 12393#0: *1 HTTP/1.1 404 Not Found
Posted at Nginx Forum:
Hi, I recently upgraded to nginx 0.8.53 as it has support for regular expressions in the server_name directive. However, when using this, the index directive gets ignored and a directory listing is displayed. I've included part of the file which is...
eckstac
December 15, 2010, 11:05pm
4
Was this debug log enough for you to use, or do you need any additional
information?
Posted at Nginx Forum:
Hi, I recently upgraded to nginx 0.8.53 as it has support for regular expressions in the server_name directive. However, when using this, the index directive gets ignored and a directory listing is displayed. I've included part of the file which is...
eckstac
December 16, 2010, 2:18am
5
Hello!
On Tue, Dec 14, 2010 at 06:23:36AM -0500, eckstac wrote:
Has anyone experienced similar issues to this?
server {
server_name ~^staging-(?P.+).(?P.+).com$;
root
/var/www/htdocs/site1/staging/$domain-staging-$version/public/;
autoindex on;
error_log /var/log/nginx/site1-staging.error.log info
index index.php index.html index.htm;
You have no “;” after error_log directive, so “index index.php
index.html index.htm” are interpreted as log levels.
Attached patch improves error_log parser to actually complain on
invalid log levels. I.e. your config will report error on
startup/test instaed of silently eating index directive.
Maxim D.
eckstac
December 16, 2010, 10:44am
6
D’oh! Schoolboy error. Thanks for pointing that out!
Posted at Nginx Forum:
Hi, I recently upgraded to nginx 0.8.53 as it has support for regular expressions in the server_name directive. However, when using this, the index directive gets ignored and a directory listing is displayed. I've included part of the file which is...