[horde] nginx dynamic view problem?

A. Schulze sca at andreasschulze.de
Fri Jan 9 13:47:24 UTC 2015


Ruud Baart:

> I intend to replace apache with nginx: more speed, better scalable
I have an other important point to support nginx:
If you run all webservers with nginx it's not funny to run apache  
dedicated to horde...

>    root /srv/webmail/horde;
>    location / {
>       root /srv/webmail/horde;
one of the "root" statements is not needed.

>       try_files $uri $uri/ /rampage.php?$args;
same here...

>          fastcgi_param PHP_VALUE "cgi.fix_pathinfo=1";
not needed here

>          fastcgi_split_path_info ^(.+\.php)(/.+)$;
only needed for /services/ajax.php

>          fastcgi_param PATH_INFO $fastcgi_path_info;
not needed here

>          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
in my fastcgi.conf

>       location ~* ^/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
>          root /srv/webmail/horde;
also: "root" should be not needed here
And without the "root" statement there is no need to mention these  
files at all
-> could be removed, too

my config:
     root                    /path/to/horde/;
     index                   index.php;

     location / {

         location ^~ /static/ {
             expires             4w;
             add_header          Cache-Control public;
         }
         location ^~ /themes/ {
             expires             4w;
             add_header          Cache-Control public;
         }

         location ^~ /services/ajax.php {
             fastcgi_split_path_info     ^(.+\.php)(/.+)$;
             fastcgi_pass                unix:/var/run/php-socket;
             include                     /etc/nginx/fastcgi.conf;
         }

         location ~ \.php {
             fastcgi_pass                unix:/var/run/php-socket;
             include                     /etc/nginx/fastcgi.conf;
         }

         try_files               $uri $uri/ /rampage.php?$args;
     }

my /etc/nginx/fastcgi.conf:
     fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
     fastcgi_param  QUERY_STRING       $query_string;
     fastcgi_param  REQUEST_METHOD     $request_method;
     fastcgi_param  CONTENT_TYPE       $content_type;
     fastcgi_param  CONTENT_LENGTH     $content_length;
     fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
     fastcgi_param  REQUEST_URI        $request_uri;
     fastcgi_param  DOCUMENT_URI       $document_uri;
     fastcgi_param  DOCUMENT_ROOT      $document_root;
     fastcgi_param  SERVER_PROTOCOL    $server_protocol;
     fastcgi_param  HTTPS              $https if_not_empty;
     fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
     fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
     fastcgi_param  REMOTE_ADDR        $remote_addr;
     fastcgi_param  REMOTE_PORT        $remote_port;
     fastcgi_param  SERVER_ADDR        $server_addr;
     fastcgi_param  SERVER_PORT        $server_port;
     fastcgi_param  SERVER_NAME        $server_name;
     fastcgi_param  REDIRECT_STATUS    200;

The Socket /var/run/php-socket is provided by PHP started by supervise.
No idea if php-fpm have any benefits.

cat run_php:

     #!/bin/sh
     exec < /dev/null
     exec 2>&1
     cd /empty
     exec env - setuidgid www-run /usr/bin/php5-cgi --bindpath  
/var/run/php-socket --no-chdir

Suggestion: create a Wiki area to describe useful settings for any  
support webservers.

Andreas



More information about the horde mailing list