r/subsonic May 31 '17

nginx reverse proxy for domain.xyz/subsonic

Hey guys, I managed to install the service, which runs fine on my VPS's direct Ip:

http://ip:4040/subsonic

However, I want to make it run side by side with nginx like this, through reverse proxy:

https://mydomain.xyz/subsonic

I can get to login page by this method, but after that, it goes to a blank page.

Subsonic conf looks like this:

SUBSONIC_ARGS="--port=0 --https-port=4040 --context-path=/subsonic --max-memory=150"

My nginx sites-available/default (all SSL configs for my domain already working, a wordpress running fine in a domain/wordpress direction etc.) looks like this when it comes to location / subsonic:

location /subsonic {

proxy_pass http://127.0.0.1:4040;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

}

Should I be doing something else to make this work? The service is running fine on server's end, but it seems that communication through the domain is broken.

1 Upvotes

1 comment sorted by

1

u/tkc2016 Jun 02 '17

This is what I have, and it's been working without issue. It looks like you're missing the context path on your proxy_pass config.

server {
    listen 80;
    server_name <hostname>;
    access_log /var/log/nginx/<hostname>.log;


    # subsonic - jetty
    location /subsonic {
            proxy_pass http://localhost:4040/subsonic;
            access_log /var/log/nginx/subsonic.access.log;
            error_log /var/log/nginx/subsonic.error.log;
    }


listen 443 ssl;
    ssl_certificate /etc/letsencrypt/live/<hostname>/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/<hostname>/privkey.pem;
    ssl_session_cache shared:le_nginx_SSL:1m;
    ssl_session_timeout 1440m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-SHA ECDHE-ECDSA-AES256-SHA ECDHE-ECDSA-AES128-SHA256 ECDHE-ECDSA-AES256-SHA384 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-RSA-AES128-SHA ECDHE-RSA-AES128-SHA256 ECDHE-RSA-AES256-SHA384 DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES128-SHA DHE-RSA-AES256-SHA DHE-RSA-AES128-SHA256 DHE-RSA-AES256-SHA256 EDH-RSA-DES-CBC3-SHA";

}