Skip to content

Instantly share code, notes, and snippets.

@mrofi
Created November 13, 2018 02:28
Show Gist options
  • Save mrofi/9f94e03d9138b8d77f2c0ef8ae107fb1 to your computer and use it in GitHub Desktop.
Save mrofi/9f94e03d9138b8d77f2c0ef8ae107fb1 to your computer and use it in GitHub Desktop.
OSX NGINX Config (Install via Homebrew)
user <user> staff;
worker_processes auto;
error_log /var/log/nginx/error.log debug;
events {
worker_connections 256;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
error_page 404 /404.html;
error_page 403 /403.html;
# access_log /var/log/nginx/access.log main;
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
server_tokens off;
##
# Buffers
##
client_body_buffer_size 128K;
client_header_buffer_size 1k;
client_max_body_size 0;
large_client_header_buffers 4 4k;
output_buffers 1 32k;
postpone_output 1460;
##
# Timeout
##
client_body_timeout 50s;
client_header_timeout 50s;
keepalive_timeout 100s;
proxy_read_timeout 50s;
send_timeout 30s;
include /usr/local/etc/nginx/sites-enabled/*;
}
server {
listen 80;
server_name ~^(www\.)?(?<sname>.+?).your.domain$;
root /path/to/$sname/public;
location ~ /.well-known {
allow all;
}
# ssl_certificate /usr/local/etc/letsencrypt/live/servername.com/fullchain.pem;
# ssl_certificate_key /usr/local/etc/letsencrypt/live/servername.com/privkey.pem;
access_log /var/log/nginx/$sname.access.log;
error_log /var/log/nginx/$name.error.log;
index index.php index.html index.htm;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#include /etc/nginx/ssl.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment