Configuration problem

Denis F. Latypoff latypoff at yandex.ru
Tue May 29 10:27:17 UTC 2012


29.05.2012, 17:22, "Ian Hobson" <ian at ianhobson.co.uk>:
> 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 example.com  virtual server
> server {
>      listen   80;
>      server_name example.com www.example.com;
>      root /var/www/example.com/htdocs;
>      access_log  /var/www/example.com/access.log;
>      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/example.com/passwords;
>      }
>      location ^~ /lists {
>          root /var/www/phplist;
>      }
>      location ~ \.php$ {
>          include /etc/nginx/fastcgi_params;
>          fastcgi_pass 127.0.0.1:9000;
>          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
>      }
+      location ~ ^/lists/.+\.php$ {
+          root /var/www/phplist;
+          include /etc/nginx/fastcgi_params;
+          fastcgi_pass 127.0.0.1:9000;
+          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?
>
> Thanks
>
> Ian
>

-- 
br, Denis F. Latypoff.



More information about the nginx mailing list