Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Basic nginx question, serve in subdirectory on website

$
0
0
Hello,

I'm following the guide at http://arstechnica.com/information-technology/2014/04/taking-e-mail-back-part-4-the-finale-with-webmail-everything-after/2/ for setting up roundcube webmail with nginx. The guide is aimed at using the base website url, however I want to use a subdirectory like https://www.example.com/webmail. I can't for the life of me get that to work.

I'm using the exact config at the above mentioned site:

server {
server_name www.yourdomain.com;
listen 80;
return 301 https://mail.yourdomain.com$request_uri;
}

server {
server_name mail.yourdomain.com;
listen 80;
return 301 https://$host$request_uri;
}

# HTTPS server
server {
listen 443 ssl spdy default_server;
server_name mail.yourdomain.com;
root /usr/share/nginx/roundcube;
index index.html index.php;
autoindex off;

ssl on;
ssl_certificate /etc/ssl/private/ssl-chain-mail-yourdomain.pem;
ssl_certificate_key /etc/ssl/private/ssl-key-decrypted-mail-yourdomain.key;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5:!DSS;
ssl_prefer_server_ciphers on;
ssl_ecdh_curve secp521r1;

# Client auth via certs
# ssl_client_certificate /etc/ssl/private/yourdomain.crt;
# ssl_trusted_certificate /etc/ssl/private/yourdomain.crt;
# ssl_verify_client on;

location / {
# if ($ssl_client_s_dn !~* "you@yourdomain.com") {
# return 301 http://www.jurassicsystems.com/;
# }
# error_page 403 @fallback;
}

location ~ ^/(README|INSTALL|LICENSE|CHANGELOG|UPGRADING)$ {
deny all;
}

location ~ ^/(bin|SQL)/ {
deny all;
}

location ~ ^/.*\.php {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass php5-fpm-sock;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}

location @fallback {
return 301 http://www.jurassicsystems.com/;
}
}



I've tried altering above config as follows:

...

# HTTPS server
server {
listen 443 ssl spdy default_server;
server_name mail.yourdomain.com;
# root /usr/share/nginx/roundcube;
# index index.html index.php;
# autoindex off;

ssl on;
ssl_certificate /etc/ssl/private/ssl-chain-mail-brianbeijl.nl.pem;
ssl_certificate_key /etc/ssl/private/ssl-key-decrypted-mail-brianbeijl.nl.key;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AES:RSA+3DES:!ADH:!AECDH:!MD5:!DSS;#
ssl_prefer_server_ciphers on;
ssl_ecdh_curve secp521r1;

location /webmail {
root /usr/share/nginx/roundcube;
index index.html index.php;
autoindex off;
}

...

hence the attempt at using location /webmail. This however displays an 404 after reloading nginx.

I don't know anything about nginx, however I did try to find out how I should be doing this. I have been unable to succeed unfortunately. Is there something I'm missing in the nginx config, or should I be looking in the roundcube webmail config?

Any help is appreciated!

Viewing all articles
Browse latest Browse all 4759

Trending Articles