Nginx configurations example for drrr.com, please note this is NOT a full config for Nginx, please modifiy these settings for your environment.
nginx.conf:
...
upstream php_fpm_backend {
server unix:/var/run/php-fpm-www0.sock;
server unix:/var/run/php-fpm-www1.sock;
}
...
drrr.conf:
server {
listen 80;
listen [::]:80;
server_name drrr.com;
error_log /srv/www/drrr.com/logs/error.log error;
root /srv/www/drrr.com/public_html;
# Maintenance redirect
# location = / {
# rewrite ^ /offline/ redirect;
# }
# Basic try_files
location / {
try_files $uri $uri/ /index.php?controller=$uri&$args;
expires 2m;
}
# Deny public access to /trust_path/
location ~* /trust_path(.*) {
internal;
}
# Static HTML
location ~* status.json$ {
add_header Access-Control-Allow-Origin *;
}
# Static assets, with .mp3 support for drrr.com
location ~* \.(mp3|m4a)$ {
add_header "Access-Control-Allow-Origin" "http://drrr.com";
valid_referers none server_names *.drrr.com;
if ($invalid_referer) {
return 444;
}
expires max;
}
# PHP backend
location ~* \.php$ {
try_files $uri =404;
fastcgi_pass php_fpm_backend;
include sparanoid-php-fpm.conf;
include fastcgi_params;
}
# Custom error page for drrr.com
error_page 401 403 404 500 502 503 504 /error/index.html;
include sparanoid-normalize.conf;
}
sparanoid-php-fpm.conf:
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
expires -1;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_buffers 4 256k;
fastcgi_buffer_size 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;