diff --git a/README.md b/README.md index e4b0fd7..a826562 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,152 @@ -# radio +# Radio -Source code for my radio website \ No newline at end of file +This is my attempt at making a repo for my radio website found at https://radio.dou.bet. It needs a lot of work to be more "generic" for others to use, but it is a start nontheless. + +## WARNING + +This code isn't production ready. My website is hard coded in most files. There is no standard for coding. I created this to tell myself "Yes you can stream an internet radio station from home". + +## Features +- Live broadcast using [icecast](https://icecast.org/) +- Detailed listening history +- DJing software provided by [mixxx](https://mixxx.org/) +- Artwork and Lyrics using [Genius API](https://docs.genius.com/) +- Live polling of stream count + +## Prerequisites +- You have already compiled and installed icecast +- You have downloaded and installed mixxx +- You have configured icecast and pointed it to your server name i.e. radio.my.domain +- You have added your icecast server to the Live Broadcasting source connection in mixxx +- You have music you want to stream on the internet + +## Install + +This section will eventually be populated with what you should do. For now, it is just `cd /var/www && sudo -u www-data git pull https://git.dou.bet/iamdoubz/radio radio` and then add a virtual host for your favorite web frontend. NOTE: my website is hard coded in most of these files. Each file will need to be checked to point to your actual radio streaming website. + +## nginx example + +This isn't a complete example, but the overall base should be covered. + +``` +server { + server_name radio.my.domain; + root /var/www/radio; + include defaults-http.conf; +} +server { +### Default config ### + server_name radio.my.domain; + include defaults-https.conf; +### Block HTTP/1.0 traffic +if ($server_protocol = HTTP/1.0) { + return 444; +} +### Performance tuning config ### + client_max_body_size 16M; + client_body_timeout 300s; + client_body_buffer_size 256k; +### Default headers ### + add_header Referrer-Policy "no-referrer" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Permitted-Cross-Domain-Policies "none" always; + add_header X-Robots-Tag "noindex, nofollow" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header Strict-Transport-Security "max-age=15768000" always; + add_header Permissions-Policy "browsing-topics=(self), geolocation=(self), midi=(self), sync-xhr=(self), microphone=(self), camera=(self), magnetometer=(self), gyroscope=(self), fullscreen=(self), payment=(self), interest-cohort=()"; +### Proxy php rules ### + index index.php index.html /index.php$request_uri; + fastcgi_buffers 64 4K; + fastcgi_hide_header X-Powered-By; + proxy_intercept_errors off; + + root /var/www/radio; + access_log /var/log/nginx/radio_access.log; + error_log /var/log/nginx/radio_error.log info; + + location = /peers.xsl { + access_log off; + 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_set_header Host $http_host; + proxy_pass http://127.0.0.1:10038/status-json.xsl; + proxy_redirect off; + proxy_ssl_verify off; + proxy_http_version 1.1; + } + location = /status-json.xsl { + access_log off; + 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_set_header Host $http_host; + proxy_pass http://127.0.0.1:10038; + proxy_redirect off; + proxy_ssl_verify off; + proxy_http_version 1.1; + } + location = /stream { + 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_set_header Host $http_host; + proxy_pass http://127.0.0.1:10038; + proxy_redirect off; + proxy_ssl_verify off; + proxy_http_version 1.1; + } + location = /peers2.xsl { + access_log off; + 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_set_header Host $http_host; + proxy_pass http://192.168.1.24:10036/status-json.xsl; + proxy_redirect off; + proxy_ssl_verify off; + proxy_http_version 1.1; + } + location = /status-json2.xsl { + access_log off; + 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_set_header Host $http_host; + proxy_pass http://192.168.1.24:10036/status-json.xsl; + proxy_redirect off; + proxy_ssl_verify off; + proxy_http_version 1.1; + } + + location = /stream2 { + 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_set_header Host $http_host; + proxy_pass http://192.168.1.24:10036; + proxy_redirect off; + proxy_ssl_verify off; + proxy_http_version 1.1; + } + + location ~ \.php$ { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + set $path_info $fastcgi_path_info; + try_files $fastcgi_script_name =404; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; + fastcgi_param HTTPS on; + fastcgi_param modHeadersAvailable true; + fastcgi_param front_controller_active true; + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + fastcgi_max_temp_file_size 0; + fastcgi_index index.php; + fastcgi_pass unix:/run/php/php8.3-fpm.sock; + } +} + +```