How to replace Apache with Nginx on Horde installation?

Discussion in 'HOWTO-Related Questions' started by swehes, Aug 15, 2012.

  1. swehes

    swehes New Member

    So I followed the instructions on "Install Horde 4 Webmail For ISPConfig On Debian Squeeze Through PEAR" on a clients Ubuntu Machine. It worked great (after I realized I needed to go in and point IMP to my email server). However on my own machine I am running Nginx for testing and I have been trying to figure out how to make the Directive work.

    I found some samples at http://comments.gmane.org/gmane.comp.horde.user/28055 but even with changing some things to fit more in my server, it still doesn't work. Then I took my Roundcube directives and tried to change the root folder and directory so it would point in the right direction but still get the 404 error.

    Does anyone running nginx and Horde have the instructions on how to get it to work?

    Also what PHP open_basedir does Horde need in ISPconfig?
     
  2. falko

    falko Super Moderator

    Where exactly do you get the 404?

    Can you post the Apache rewrite rules and the ones you're using for nginx so far?
     
  3. swehes

    swehes New Member

    The 404 comes with I try http://www.domain.com/horde

    Directives for Apache I just used the howtoforge instructions on http://www.howtoforge.com/install-horde-4-webmail-for-ispconfig-on-debian-squeeze-through-pear

    Alias /Microsoft-Server-ActiveSync /var/www/horde/rpc.php
    Alias /horde /var/www/horde
    <Directory /var/www/horde>
    Options +FollowSymLinks
    AllowOverride None
    order allow,deny
    allow from all
    AddType application/x-httpd-php .php
    php_value include_path ".:/usr/share/php"
    php_value open_basedir "none"
    php_value upload_tmp_dir "/var/www/horde/phptmp/"
    </Directory>

    Nginx directives according to http://comments.gmane.org/gmane.comp.horde.user/28055
    location ~ \.php {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param HTTPS $php_https;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }

    location /Microsoft-Server-ActiveSync {
    alias /var/www/horde/rpc.php;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param HTTPS $php_https;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }

    Trying to use Roundcube directives with Horde changes:
    location /horde {
    root /var/www/;
    index index.php index.html index.htm;
    location ~ ^/horde/(.+\.php)$ {
    try_files $uri =404;
    root /var/www/;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param HTTPS $fastcgi_https; # <-- add this line
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    include /etc/nginx/fastcgi_params;
    fastcgi_param PATH_INFO $fastcgi_script_name;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 256 4k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_intercept_errors on;
    }
    location ~* ^/horde/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt|php))$ {
    root /var/www/;
    }
    }
    location /webmail2 {
    rewrite ^/* /horde last;
    }
     
  4. falko

    falko Super Moderator

    Does Horde use any .htaccess files with rewrite rules?
     
  5. swehes

    swehes New Member

    Yes. The .htaccess is as follows.

    allow from all

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ rampage.php [QSA,L]
    </IfModule>
     
  6. falko

    falko Super Moderator

    This is equivalent to

    Code:
           location / {
                    try_files $uri $uri/ /rampage.php?$args;
           }
    on nginx.
     

Share This Page