Configuration problem

Ian Hobson ian at
Tue May 29 10:22:06 UTC 2012

Hi All,

I wish to configure phplist under nginx on multiple domains.

phplist is installed into /lists in the root directory, and 
/lists/config/config.php is amended to give access to a php database.

I though to move /lists to a location outside the normal web tree, 
replace /config/config.php with a script to test the domain name in 
$_SERVER, and load the appropriate configuration parameters.

So the first job is to move /lists for one domain and get that working. 
  The nginx configuration I have tried is this.

# Statements for  virtual server
server {
     listen   80;
     root /var/www/;
     access_log  /var/www/;
     index index.php index.html index.htm;
     location = /favicon.ico {
         log_not_found off;
         access_log off;
     location = /robots.txt {
         allow all;
         log_not_found off;
         access_log off;
     location ^~ /usage {
       auth_basic "Hello, please login";
       auth_basic_user_file /var/www/;
     location ^~ /lists {
         root /var/www/phplist;
     location ~ \.php$ {
         include /etc/nginx/fastcgi_params;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     try_files $uri $uri/ /index.php;

The idea being that the " location ^~ /lists {" stanza moves the root, 
and the "location ~ \.php$ {" stanza sends .php files off to fast_cgi, 
while nginx serves other assets from the relevant one of the two roots.

Unfortunately, nginx serves the phplist php files, without passing them 
to fast_cgi, and the browser treats them as downloads. :(

What is wrong with my configuration?



More information about the nginx mailing list