Nginx reverse-proxy issue

Need help? Post your questions here.

Moderator: moderators

Nginx reverse-proxy issue

Postby grimy55 » Wed May 28, 2014 3:23 am

Hi all,

I installed Subsonic on Ubuntu 14.04 behind a Nginx reverse-proxy handling an SSL tunneling through the common port 443.
A direct connection to Subsonic without the Nginx reverse proxy works just fine:
Code: Select all
http://{IP}:4040/subsonic

The SSL connection through Nginx works only if the login page is specified in the url:
Code: Select all
https://{IP}/subsonic/login.view?

If I remove the login page in the url such as below, I get a 404 error "The requested URL /subsonic/ was not found on this server."
Code: Select all
https://{IP}/subsonic

Of course, I would want to use this last fancy URL on a daily basis. Is there anyone with a hunch on what's wrong ?


Here is my subsonic configuration:
Code: Select all
$ cat /etc/default/subsonic
SUBSONIC_ARGS="--context-path=/subsonic --port=4040 --https-port=0 --max-memory=300"
SUBSONIC_USER=www-data

and my Nginx reverse proxy configuration:
Code: Select all
$ cat /etc/nginx/sites-enabled/proxy_ssl.conf
server {
        listen 443;

        root /var/www/;
        index index.php index.html index.htm;

        server_name {server.net};

        ssl on;
        ssl_certificate {crt_path};
        ssl_certificate_key {key_path};

        location /subsonic {
                proxy_redirect off;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://127.0.0.1:4040;
        }
}


Thank you !
grimy55
 
Posts: 12
Joined: Fri Jun 03, 2011 2:39 pm

Re: Nginx reverse-proxy issue

Postby daneren2005 » Wed May 28, 2014 4:25 am

I have proxy_redirect in my config, but commented out. Might have had issues as well while setting it up. In the location I have /subsonic/ instead of just /subsonic. I have a rewrite rule in there:
Code: Select all
rewrite ^/subsonic$ /subsonic/ permanent;


I also use a https redirect (ie: https-port=4040 instead of port=4040 + redirect to https instead of http). Try each change until one works ;)
Developer of DSub for Android
daneren2005
 
Posts: 1709
Joined: Fri Jul 06, 2012 7:52 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 67 guests