Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf0020e
commit ab98190
Showing
22 changed files
with
483 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
--- | ||
layout: page | ||
permalink: /additional-topics/behind-a-reverse-proxy | ||
title: Behind a reverse proxy | ||
--- | ||
|
||
myMPD could be hosted behind a reverse proxy to add features like http2 and authentication. | ||
|
||
Configure myMPD to disable ssl and listen on localhost on port 8080. | ||
|
||
``` | ||
printf "false" > /var/lib/mympd/config/ssl | ||
printf "8080" > /var/lib/mympd/config/http_port | ||
printf "127.0.0.1" > /var/lib/mympd/config/http_host | ||
``` | ||
|
||
In this examples myMPD is proxied behind the path `/mympd`. | ||
|
||
*** | ||
|
||
# Nginx | ||
|
||
``` | ||
location /mympd/ { | ||
proxy_pass http://127.0.0.1:8080/; | ||
} | ||
``` | ||
|
||
*** | ||
|
||
# Apache | ||
|
||
## Basic setup with proxypass | ||
|
||
To access mympd behind apache2 enable following modules, e.g. with `a2enmod`: | ||
- proxy | ||
- proxy_wstunnel | ||
|
||
Add the following to a existing or a new virtual host: | ||
``` | ||
ProxyRequests Off | ||
ProxyPreserveHost on | ||
ProxyVia On | ||
ProxyPass /mympd/ws/ ws://127.0.0.1:8080/ws/ | ||
Redirect /mympd /mympd/ | ||
ProxyPass /mympd/ http://127.0.0.1:8080/ | ||
ProxyPassReverse /mympd/ http://127.0.0.1:8080/ | ||
``` | ||
|
||
## Basic Password Authentication | ||
|
||
To add basic password authentication create a new htpasswd file | ||
`sudo htpasswd -c <path/to/htpasswd/file> <username to access mympd>` | ||
|
||
Or append an existing htpasswd file | ||
`sudo htpasswd <path/to/htpasswd/file> <username to access mympd>` | ||
|
||
for example: | ||
`sudo htpasswd -c /etc/apache2/.htpasswds mympd` | ||
|
||
Then add the following to your mympd Location in your apache virtualhost configuration file | ||
|
||
``` | ||
AuthType Basic | ||
AuthName "Authentication Required" # or add any type of identifier you prefer | ||
AuthUserFile <path/to/htpasswd/file> # for example /etc/apache2/.htpasswds | ||
Require valid-user | ||
``` | ||
|
||
for example: | ||
|
||
``` | ||
<Location "/mympd/"> | ||
AuthType Basic | ||
AuthName "Authentication Required" # or add any type of identifier you prefer | ||
AuthUserFile <path/to/htpasswd/file> # for example /etc/apache2/.htpasswds | ||
Require valid-user | ||
</Location> | ||
``` | ||
See https://wiki.apache.org/httpd/PasswordBasicAuth for more information | ||
|
||
## Simple Access Control | ||
|
||
To limit acces to mympd to the local network, add the following to the location directive adjusting for your own network: | ||
|
||
``` | ||
Require host localhost | ||
Require ip <ipaddress> | ||
Require ip <ip range/netmask> # ex 192.168.1.0/24 | ||
``` | ||
|
||
See https://httpd.apache.org/docs/2.4/howto/access.html for more information | ||
|
||
## Full Example Config | ||
|
||
``` | ||
<VirtualHost *:80> | ||
ServerName yourserver.example.com | ||
ProxyRequests Off | ||
ProxyPreserveHost on | ||
ProxyVia On | ||
<Location "/mympd/"> | ||
Require host localhost | ||
Require ip 192.168.1.0/24 | ||
AuthType Basic | ||
AuthName "Authentication Required" | ||
AuthUserFile /etc/apache2/.passwds/mympd | ||
Require valid-user | ||
</Location> | ||
ProxyPass /mympd/ws/ ws://127.0.0.1:8080/ws/ | ||
Redirect /mympd /mympd/ | ||
ProxyPass /mympd/ http://127.0.0.1:8080/ | ||
ProxyPassReverse /mympd/ http://127.0.0.1:8080/ | ||
</VirtualHost> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
layout: page | ||
permalink: /additional-topics/ | ||
title: Additional topics | ||
--- | ||
|
||
- [Behind a reverse proxy]({{ site.baseurl }}/additional-topics/behind-a-reverse-proxy) | ||
- [Recommended MPD configuration]({{ site.baseurl }}/additional-topics/recommended-mpd-configuration) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
layout: page | ||
permalink: /additional-topics/recommended-mpd-configuration | ||
title: Recommended MPD configuration | ||
--- | ||
|
||
myMPD needs the following mpd settings for all features. If a feature is not enabled in mpd, myMPD disables the associated features. | ||
|
||
``` | ||
# Enable stickers - myMPD uses stickers for play statistics | ||
sticker_file "/var/lib/mpd/sticker.sql" | ||
# Enable stored playlists, also needed for myMPD smart playlists | ||
playlist_directory "/var/lib/mpd/playlists" | ||
# Enable metadata. If set to none, you can only browse the filesystem | ||
metadata_to_use "AlbumArtist,Artist,Album,Title,Track,Disc,Genre" | ||
# bind mpd to a unix socket | ||
bind_to_address "/run/mpd/socket" | ||
# Mounting is only possible with the simple database plugin and a cache_directory | ||
database { | ||
plugin "simple" | ||
path "/var/lib/mpd/tag_cache" | ||
cache_directory "/var/lib/mpd/cache" | ||
} | ||
# Enable neighbor plugins | ||
neighbors { | ||
plugin "smbclient" | ||
} | ||
neighbors { | ||
plugin "udisks" | ||
} | ||
neighbors { | ||
plugin "upnp" | ||
} | ||
# Ouput for http stream - myMPD local playback | ||
audio_output { | ||
type "httpd" | ||
name "HTTP Stream" | ||
encoder "lame" #to support safari on ios | ||
port "8000" | ||
bitrate "128" | ||
format "44100:16:1" | ||
always_on "yes" | ||
tags "yes" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.