Welcome! Log In Create A New Profile

Advanced

Re: Configuration problem

Denis F. Latypoff
May 29, 2012 06:28AM
29.05.2012, 17:22, "Ian Hobson" <ian@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.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Configuration problem

hobson42 May 29, 2012 06:24AM

Re: Configuration problem

Denis F. Latypoff May 29, 2012 06:28AM

Re: Configuration problem

Ruslan Ermilov May 29, 2012 08:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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