Horde5, IMP6 with NginX (under FreeBSD)

Install horde from ports (mail/horde-webmail)

Create the following server entry in your preferred config file.

server {
  server_name horde.example.org;
  access_log /var/log/nginx/horde.example.org-access.log;
  error_log /var/log/nginx/horde.example.org-error.log;
  root /usr/local/www/horde/;
  index index.php;
  location / {
    try_files $uri $uri/ /rampage.php?$args;
  }
  location ~ \.php {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_param PHP_VALUE "cgi.fix_pathinfo=1";
    fastcgi_pass unix:/var/run/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

Enjoy!

Notes:
Some other config files say location ~ \.php$ { This will stop uris such as /services/ajax.php/imp/ being matched correctly.

5 thoughts on “Horde5, IMP6 with NginX (under FreeBSD)”

  1. I tried this and got a message 502 Bad Gateway:

    ssl_certificate /way_to_my_ssl_directory/server.crt;
    ssl_certificate_key /way_to_my_ssl_directory/server.key;
    server {
    listen 443 ssl;
    server_name http://www.webmail.my_domain.com *.webmail.my_domain.com;
    root /way_to_my_web_directory/horde;
    ssl on;
    access_log /way_to_my_web_directory/horde/webmail.my_domain.com-access.log;
    error_log /way_to_my_web_directory/horde/webmail.my_domain.com-error.log;

    index index.php;
    location / {
    try_files $uri $uri/ /rampage.php?$args;
    }
    location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_param PHP_VALUE “cgi.fix_pathinfo=1”;
    fastcgi_pass unix:/var/run/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    }

  2. Victor,
    My configuration is FreeBSD specific. the 502 error suggests that you’ve used the wrong location for fastcgi_pass.

    On Debian it is at /var/run/php5-fpm.sock not /var/run/php-fpm.sock, I’d expect Ubuntu to be the same.

    A.

  3. Hi avatastic !
    Hadn’t really noticed this line …
    But even making the correction, continued getting errors:
    …Not a directory or …No file
    I tried to install nginx 1.4.2, but I have problems with many other things… So, I’m backing to ppa.1.4.1 with the same problem on Horde…

    I tried this too, without sucess: http://lowendtalk.com/discussion/7506/anybody-knows-how-to-install-horde-5-with-nginx

    Any ideas is welcome, thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *