Last active
May 24, 2023 05:00
-
-
Save BenMatheja/9230138 to your computer and use it in GitHub Desktop.
mopidy port 80 proxy pass with nginx on raspberry pi
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
sudo apt-get update | |
sudo apt-get install nginx | |
sudo service nginx start | |
sudo vi /etc/nginx/sites-enabled/default | |
##### VI output, oder nano jenachdem mit was du die ändern willst ### | |
server { | |
#listen 80; ## listen for ipv4; this line is default and implied | |
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6 | |
root /usr/share/nginx/www; | |
index index.html index.htm; | |
# Make site accessible from http://localhost/ | |
server_name localhost; | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
# try_files $uri $uri/ /index.html; | |
# Uncomment to enable naxsi on this location | |
# include /etc/nginx/naxsi.rules | |
proxy_pass http://localhost:6680; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
####### | |
sudo service nginx restart | |
######### | |
proxy pass airpi.local:80 -> airpi.local:6680 eingerichtet | |
Websocket im interface auf folgendes ändern .. abhängig von der ip deines pi's . ipv6 namen funktionieren auch | |
jedoch nicht auf android geräten so wie ich das gerade sehe - also doch IP verwenden | |
ws://airpi.local:6680/mopidy/ws/ |
Give this a try if you want to set a default web client
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
#rewrite "^i.$" /moped/ break;
proxy_pass http://localhost:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
rewrite /mopidy/(.*) /mopidy/$1 break;
rewrite /(.*) /moped/$1 break;
proxy_redirect off;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Super! This is what I needed, my websockets didn't work properly, but with these setting they do.