Skip to content

Instantly share code, notes, and snippets.

@sgreve
Forked from cbednarski/nginx.conf
Created January 11, 2019 12:07
Show Gist options
  • Save sgreve/886a7f8d9a255f81421080faf2bc8f2c to your computer and use it in GitHub Desktop.
Save sgreve/886a7f8d9a255f81421080faf2bc8f2c to your computer and use it in GitHub Desktop.
Nginx and php-fpm configs for local development
server {
listen 8080;
server_name local.webblob.com;
root /Users/cbednarski/code/WebBlob/src;
error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
error_page 504 /504.html;
location / {
index index.html index.htm;
try_files $uri /index.php;
}
# Handles generic .php files
location ~ \.php$ {
fastcgi_pass unix:/usr/local/var/php-fpm.sock;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
# Handles a front-controller
location /index.php {
fastcgi_pass unix:/usr/local/var/php-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_intercept_errors on;
}
location ~ /([0-9][0-9][0-9]).html {
try_files $1.html @error;
internal;
}
location @error {
# see: https://github.com/cbednarski/slick-error-pages
root /Users/cbednarski/code/slick-error-pages;
}
}
[global]
pid = /usr/local/var/run/php-fpm.pid
error_log = /usr/local/var/log/php/5.4/php_fpm.error.log
daemonize = no
emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 10s
[www]
listen = /usr/local/var/php-fpm.sock
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.status_path = /fpm_status
pm.max_children = 256
pm.start_servers = 25
pm.min_spare_servers = 5
pm.max_spare_servers = 50
pm.max_requests = 4000
slowlog = /usr/local/var/log/php/5.4/php_fpm.slow.log
request_slowlog_timeout = 10
request_terminate_timeout = 60
catch_workers_output = yes
php_value[date.timezone] = America/Los_Angeles
php_value[error_reporting] = E_ALL & ~E_STRICT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment