0

First off, thanks in advance for reading/helping. I have an Nginx server which I'm trying to get to pull squirrelmail from /usr/share/squirrelmail.

The squirrelmail folder is at /usr/share/squirrelmail and the owner and group of that folder is www-data. I've set up a location and alias to point /test (at https://brailsford.xyz/test/) at the squirrelmail folder. However, the page displays not found. Any ideas?

Below is my nginx config for the site.

server {
            listen 443;
            server_name brailsford.xyz;

        ssl on;
        ssl_certificate          /etc/ssl/certs/cert_chain.crt;
        ssl_certificate_key      /etc/ssl/private/brailsford.key;

        ssl_session_timeout 5m;

        ssl_protocols SSLv3 TLSv1;
        ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
        ssl_prefer_server_ciphers on;

        root /data/brailsford.xyz/www;
        index index.php index.html index.htm;

        location ~ \.php$ {
                include fastcgi_params;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index  index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_buffers 256 128k;
                fastcgi_connect_timeout 300s;
                fastcgi_send_timeout 300s;
                fastcgi_read_timeout 300s;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root /data/brailsford.xyz/www;
        }

        error_log /data/brailsford.xyz/logs/error.log error;
        access_log /data/brailsford.xyz/logs/access.log;

        location / {
                index index.php;
        }

        location /test {
                alias /usr/share/squirrelmail/;
                index index.php;
        }

}
0

For anyone looking at this, the issue was that the paths had to be declared twice, in the location and then as an inner location for PHP. That's a bad explanation, here's the code:

location /webmail {
                alias /var/lib/roundcube;
                try_files $uri $uri/ /index.php;
                index index.php;
                location ~ ^/webmail(.+\.php)$ {
                        include fastcgi_params;
                        alias /var/lib/roundcube/$1;
                        fastcgi_pass unix:/var/run/php5-fpm.sock;
                        fastcgi_index  index.php;
                        fastcgi_param SCRIPT_FILENAME /var/lib/roundcube$1;
                        fastcgi_buffers 256 128k;
                        fastcgi_connect_timeout 300s;
                        fastcgi_send_timeout 300s;
                        fastcgi_read_timeout 300s;
                        fastcgi_intercept_errors        on;
                }
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.