Skip to content

Instantly share code, notes, and snippets.

@renekreijveld
Created February 28, 2025 10:51
Show Gist options
  • Save renekreijveld/ee666ea5dd051b57475763e69dd568e3 to your computer and use it in GitHub Desktop.
Save renekreijveld/ee666ea5dd051b57475763e69dd568e3 to your computer and use it in GitHub Desktop.
NginX server template for local development on macOS
# http server settings
server {
listen 80;
server_name <website_name>.dev.test;
charset utf-8;
# Enforce HTTPS
return 301 https://$server_name$request_uri;
}
# https server settings
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
ssl_certificate /opt/homebrew/etc/nginx/certs/_wildcard.dev.test.pem;
ssl_certificate_key /opt/homebrew/etc/nginx/certs/_wildcard.dev.test-key.pem;
ssl_ciphers HIGH:!aNULL:!MD5;
server_name <website_name>.dev.test;
root /Users/<your_username>/Development/Sites/<website_name>;
index index.php kick.php index.html index.htm;
charset utf-8;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
# Support API
location /api/ {
try_files $uri $uri/ /api/index.php?$args;
}
location / {
try_files $uri $uri/ /index.php?$args;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
location ~ \.php$ {
fastcgi_pass <php_fpm_url>;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 1200;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment