I'm trying to setup a Horde groupware with Nginx. The webinterface works but I do not get the ActiveSync specific URL to work. The Horde Wiki explains how to use it with an Apache Webserver here.
My problem is, that I setup a rewrite (tried an alias too) to serve the location /horde/Microsoft-Server-ActiveSync
via the /horde/rpc.php
script. But with my current configuration nginx does the rewrite and returns a 200 status code. But it looks like that the php file is not executed. If I go to /horde/rpc.php
directly it opens up the login dialog. So this seems to work correct.
Firstly I was googling about the problem but could not find a working solution. So now I would like to ask you.
The configuration should allow to access the ActiveSync part via the URL /horde/Microsoft-Server-ActiveSync
. The horde webinterface is already accessible via /horde
.
My configuration looks like this:
default-ssl.conf
server {
listen 443 ssl;
ssl on;
ssl_certificate /opt/nginx/conf/certs/server.crt;
ssl_certificate_key /opt/nginx/conf/certs/server.key;
server_name example.com;
index index.html index.php;
root /var/www;
include sites-available/horde.conf;
}
horde.conf
location /horde {
rewrite_log on;
rewrite ^/horde/Microsoft-Server-ActiveSync(.*)$ /horde/rpc.php$1 last;
try_files $uri $uri/ /rampage.php?$args;
location ~ \.php$ {
try_files $uri =404;
include sites-available/horde.fcgi-php.conf;
}
}
horde.fcgi-php.conf
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_params (default nginx)
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;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
The nginx log level is set to debug. The output after the request is:
2014/06/13 10:33:15 [notice] 17332#0: *1 "^/horde/Microsoft-Server-ActiveSync(.*)$" matches "/horde/Microsoft-Server-ActiveSync", client: XX.XX.XX.XX, server: example.com, request: "GET /horde/Microsoft-Server-ActiveSync HTTP/1.1", host: "example.com"
2014/06/13 10:33:15 [notice] 17332#0: *1 rewritten data: "/horde/rpc.php", args: "", client: XX.XX.XX.XX, server: example.com, request: "GET /horde/Microsoft-Server-ActiveSync HTTP/1.1", host: "example.com"
All this is happening on a RaspberryPi with Raspbian GNU/Linux 7 (which is mainly a Debian Wheezy). So I guess the rewrite works but the php file is not processed?! Does anyone know where the problem is and how to fix it?
UPDATE:
If I change the file rpc.php
to mytest.php
with this content:
<pre>
<?php var_export( $_SERVER ); ?>
</pre>
AND change the rewrite to
rewrite ^/horde/Microsoft-Server-ActiveSync(.*)$ /horde/mytest.php$1 last;
I get the correct output:
array (
'USER' => 'www-data',
'HOME' => '/var/www',
'FCGI_ROLE' => 'RESPONDER',
'QUERY_STRING' => '',
'REQUEST_METHOD' => 'GET',
'CONTENT_TYPE' => '',
'CONTENT_LENGTH' => '',
'SCRIPT_NAME' => '/horde/mytest.php',
'REQUEST_URI' => '/horde/Microsoft-Server-ActiveSync',
'DOCUMENT_URI' => '/horde/mytest.php',
'DOCUMENT_ROOT' => '/var/www',
'SERVER_PROTOCOL' => 'HTTP/1.1',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'SERVER_SOFTWARE' => 'nginx/1.4.4',
'REMOTE_ADDR' => 'XX.XX.XX.XX',
'REMOTE_PORT' => '25330',
'SERVER_ADDR' => 'XX.XX.XX.XX',
'SERVER_PORT' => '80',
'SERVER_NAME' => 'example.com',
'REDIRECT_STATUS' => '200',
'PATH_INFO' => '',
'PATH_TRANSLATED' => '/var/www',
'SCRIPT_FILENAME' => '/var/www/horde/mytest.php',
'HTTP_HOST' => 'example.com',
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0',
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.5',
'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
'HTTP_DNT' => '1',
'HTTP_COOKIE' => 'XXX',
'HTTP_IF_MODIFIED_SINCE' => 'Thu, 12 Jun 2014 11:56:09 GMT',
'HTTP_CACHE_CONTROL' => 'max-age=0',
'HTTP_CONNECTION' => 'keep-alive',
'PHP_SELF' => '/horde/mytest.php',
'REQUEST_TIME_FLOAT' => 1402664378.2101,
'REQUEST_TIME' => 1402664378,
)
So why is the rpc.php not correctly working? If I understand correctly it tries to establish a basic authentication process. Could this be a problem?