"index" directive not working with dynamic server_name

eckstac nginx-forum at nginx.us
Tue Dec 14 14:23:36 MSK 2010


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$;

        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: http://forum.nginx.org/read.php?2,158492,158492#msg-158492

More information about the nginx mailing list