2022-05-03 21:45:41 +02:00
|
|
|
upstream php-fpm-internal {
|
|
|
|
server unix:/var/run/php-fpm-internal.sock;
|
|
|
|
}
|
|
|
|
|
|
|
|
upstream php-fpm-www {
|
|
|
|
server unix:/var/run/php-fpm-www.sock;
|
|
|
|
}
|
|
|
|
|
2019-07-28 02:46:31 +02:00
|
|
|
upstream redis_server {
|
|
|
|
nchan_redis_server "redis://localhost:6379";
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2022-05-07 15:50:48 +02:00
|
|
|
listen 127.0.0.1:6010;
|
2019-07-28 02:46:31 +02:00
|
|
|
|
2022-05-06 21:48:59 +02:00
|
|
|
root {{ app_base }}/www/web;
|
|
|
|
index index.php;
|
|
|
|
|
2022-03-01 21:51:14 +01:00
|
|
|
location ~ /pub/([^\/]+)$ {
|
2019-07-28 02:46:31 +02:00
|
|
|
nchan_publisher;
|
|
|
|
nchan_redis_pass redis_server;
|
|
|
|
|
|
|
|
nchan_channel_group "azuracast_nowplaying";
|
|
|
|
nchan_channel_id $1;
|
|
|
|
|
|
|
|
nchan_message_buffer_length 1;
|
2019-07-29 16:40:58 +02:00
|
|
|
nchan_message_timeout 16s;
|
2019-07-28 02:46:31 +02:00
|
|
|
}
|
2022-05-03 21:45:41 +02:00
|
|
|
|
|
|
|
# Default clean URL routing
|
|
|
|
location / {
|
|
|
|
try_files $uri @clean_url;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @clean_url {
|
|
|
|
rewrite ^(.*)$ /index.php last;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/index\.php(/|$) {
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
|
|
|
|
|
|
fastcgi_pass php-fpm-internal;
|
|
|
|
fastcgi_index index.php;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
|
|
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
|
|
|
include fastcgi_params;
|
|
|
|
|
|
|
|
fastcgi_read_timeout 600;
|
|
|
|
fastcgi_buffering off;
|
|
|
|
|
|
|
|
internal;
|
|
|
|
}
|
2019-07-28 02:46:31 +02:00
|
|
|
}
|
|
|
|
|
2016-05-16 15:21:51 +02:00
|
|
|
server {
|
2016-12-25 19:07:25 +01:00
|
|
|
listen 80;
|
|
|
|
listen 443 default_server ssl;
|
2020-01-02 14:26:37 +01:00
|
|
|
listen [::]:80;
|
|
|
|
listen [::]:443 default_server ssl;
|
2016-12-25 19:07:25 +01:00
|
|
|
|
2022-06-09 09:27:19 +02:00
|
|
|
ssl_certificate {{ app_base }}/acme/ssl.crt;
|
|
|
|
ssl_certificate_key {{ app_base }}/acme/ssl.key;
|
2020-06-06 08:21:17 +02:00
|
|
|
|
2016-09-07 22:57:21 +02:00
|
|
|
root {{ app_base }}/www/web;
|
2016-05-16 15:21:51 +02:00
|
|
|
index index.php;
|
|
|
|
|
|
|
|
server_name localhost;
|
|
|
|
|
2017-12-16 18:44:08 +01:00
|
|
|
add_header X-XSS-Protection 1;
|
|
|
|
add_header X-Content-Type-Options nosniff;
|
|
|
|
add_header Referrer-Policy no-referrer-when-downgrade;
|
|
|
|
|
2016-09-07 22:57:21 +02:00
|
|
|
access_log {{ app_base }}/www_tmp/access.log;
|
|
|
|
error_log {{ app_base }}/www_tmp/error.log;
|
2020-02-21 19:48:43 +01:00
|
|
|
|
2022-06-09 09:27:19 +02:00
|
|
|
# LetsEncrypt handling
|
|
|
|
location /.well-known/acme-challenge {
|
|
|
|
alias {{ app_base }}/acme/challenges;
|
|
|
|
try_files $uri =404;
|
|
|
|
}
|
|
|
|
|
2019-07-28 02:46:31 +02:00
|
|
|
# Serve a static version of the nowplaying data for non-PHP-blocking delivery.
|
|
|
|
location /api/nowplaying_static {
|
|
|
|
expires 10s;
|
|
|
|
add_header Access-Control-Allow-Origin *;
|
|
|
|
|
|
|
|
alias {{ app_base }}/www_tmp/nowplaying;
|
|
|
|
try_files $uri =404;
|
|
|
|
}
|
|
|
|
|
2016-05-16 15:21:51 +02:00
|
|
|
location / {
|
|
|
|
try_files $uri @clean_url;
|
|
|
|
}
|
|
|
|
|
|
|
|
location @clean_url {
|
|
|
|
rewrite ^(.*)$ /index.php last;
|
|
|
|
}
|
|
|
|
|
2019-07-28 02:46:31 +02:00
|
|
|
# Set up caching for static assets.
|
|
|
|
location /static {
|
|
|
|
add_header Access-Control-Allow-Origin *;
|
|
|
|
}
|
|
|
|
|
2021-07-30 08:20:14 +02:00
|
|
|
location /static/uploads {
|
|
|
|
rewrite ^(.+)\.(?:\w+)\.(js|css|png|jpg)$ $1.$2 last;
|
|
|
|
|
|
|
|
alias /var/azuracast/uploads;
|
|
|
|
try_files $uri =404;
|
|
|
|
}
|
|
|
|
|
2019-07-28 02:46:31 +02:00
|
|
|
location /static/dist {
|
|
|
|
expires 365d;
|
|
|
|
}
|
2021-09-11 22:46:31 +02:00
|
|
|
location /static/webpack_dist {
|
|
|
|
expires 365d;
|
|
|
|
}
|
2019-07-28 02:46:31 +02:00
|
|
|
|
2022-05-06 21:48:59 +02:00
|
|
|
location ~ ^/index\.php(/|$) {
|
2016-05-16 15:21:51 +02:00
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
2016-09-07 22:57:21 +02:00
|
|
|
|
2016-05-16 15:21:51 +02:00
|
|
|
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
2022-05-06 21:48:59 +02:00
|
|
|
fastcgi_pass php-fpm-www;
|
2016-05-16 15:21:51 +02:00
|
|
|
fastcgi_index index.php;
|
2022-05-06 21:48:59 +02:00
|
|
|
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
|
|
|
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
2016-05-16 15:21:51 +02:00
|
|
|
include fastcgi_params;
|
|
|
|
|
|
|
|
fastcgi_read_timeout 1800;
|
2019-06-08 23:29:18 +02:00
|
|
|
fastcgi_buffering off;
|
2022-05-06 21:48:59 +02:00
|
|
|
|
|
|
|
internal;
|
2016-05-16 15:21:51 +02:00
|
|
|
}
|
|
|
|
|
2016-09-25 22:23:36 +02:00
|
|
|
# Reverse proxy all possible radio listening ports (8000, 8010...8480, 8490)
|
|
|
|
location ~ ^/radio/(8[0-4][0-9]0)(/?)(.*)$ {
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_ignore_client_abort off;
|
|
|
|
proxy_intercept_errors on;
|
|
|
|
proxy_next_upstream error timeout invalid_header;
|
|
|
|
proxy_redirect off;
|
|
|
|
proxy_connect_timeout 60;
|
|
|
|
proxy_send_timeout 21600;
|
|
|
|
proxy_read_timeout 21600;
|
|
|
|
|
|
|
|
proxy_set_header Host localhost:$1;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
|
|
|
2018-08-11 04:03:02 +02:00
|
|
|
proxy_pass http://127.0.0.1:$1/$3?$args;
|
2016-09-25 22:23:36 +02:00
|
|
|
}
|
|
|
|
|
2019-07-28 02:46:31 +02:00
|
|
|
# pub/sub endpoints
|
2022-03-01 21:51:14 +01:00
|
|
|
location ~ /api/live/nowplaying/([^\/]+)$ {
|
2019-07-28 02:46:31 +02:00
|
|
|
nchan_subscriber;
|
|
|
|
nchan_redis_pass redis_server;
|
|
|
|
|
|
|
|
nchan_channel_group "azuracast_nowplaying";
|
|
|
|
nchan_channel_id "$1";
|
|
|
|
nchan_channel_id_split_delimiter ",";
|
2019-07-29 16:40:58 +02:00
|
|
|
|
|
|
|
nchan_subscriber_first_message -1;
|
2019-07-28 02:46:31 +02:00
|
|
|
}
|
|
|
|
|
2016-05-16 15:21:51 +02:00
|
|
|
# deny access to .htaccess files, if Apache's document root
|
|
|
|
# concurs with nginx's one
|
|
|
|
#
|
|
|
|
location ~ /\.ht {
|
|
|
|
deny all;
|
|
|
|
}
|
2020-02-21 19:48:43 +01:00
|
|
|
|
|
|
|
# Internal handlers used by the application to perform X-Accel-Redirect's for higher performance.
|
|
|
|
location /internal/backups/ {
|
|
|
|
internal;
|
2020-02-21 19:56:37 +01:00
|
|
|
alias {{ app_base }}/backups/;
|
2020-02-21 19:48:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
location /internal/stations/ {
|
|
|
|
internal;
|
2020-02-21 19:56:37 +01:00
|
|
|
alias {{ app_base }}/stations/;
|
2020-02-21 19:48:43 +01:00
|
|
|
}
|
2022-05-29 03:19:04 +02:00
|
|
|
|
|
|
|
include {{ app_base }}/stations/*/config/nginx.conf;
|
2018-02-17 21:14:44 +01:00
|
|
|
}
|