[FAQ] Madsonic + nginx proxy

Frequently asked questions. Tutorials, tips and tricks.

[FAQ] Madsonic + nginx proxy

Unread postby Madevil » 03 Jun 2017, 14:01

setup a new test environment as follow:

*) install System (debian9)
*) install Oracle Java (JDK8)
*) install Madsonic Server (6.3.9500)
*) install nginx (1.10.3)

*) create selfsign cert /etc/nginx/cert.crt

Code: Select all
cd /etc/nginx

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/cert.key -out /etc/nginx/cert.crt

*) edit nginx config

Code: Select all
sudo nano /etc/nginx/sites-enabled/default

*) replace nginx config

Code: Select all
server {
    listen 80;
    listen [::]:80;
    return 301 https://$host$request_uri;

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name localhost; # Replace localhost with your.domain.com

    ssl_certificate           /etc/nginx/cert.crt;
    ssl_certificate_key       /etc/nginx/cert.key;

    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    access_log  /var/log/nginx/madsonic.access.log;
    error_log   /var/log/nginx/madsonic.error.log;

    location /music {

      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_set_header X-Forwarded-Proto $scheme;

      proxy_pass                        http://localhost:4040;
      proxy_redirect                    http:// https://;
      proxy_read_timeout                90;
      add_header X-Frame-Options        SAMEORIGIN;

*) edit Madsonic settings:

Code: Select all
sudo nano /etc/default/madsonic

Code: Select all
MADSONIC_ARGS="--context-path=/music --port=4040 --init-memory=256 --max-memory=512"

*) restart services

Code: Select all
sudo service madsonic restart
sudo service nginx restart

*) try to access Madsonic local

Code: Select all

*) try to access Madsonic over nginx

Code: Select all

That's it! :)


Hope this help you to check your config!

Best regards
The Madsonic Team
User avatar
Posts: 942
Joined: 07 Dec 2012, 03:58
Has thanked: 1339 times
Been thanked: 964 times

Return to Info

Who is online

Users browsing this forum: No registered users and 1 guest