Skip to content

Instantly share code, notes, and snippets.

@merk
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merk/1a3a3043f8e844d684e0 to your computer and use it in GitHub Desktop.
Save merk/1a3a3043f8e844d684e0 to your computer and use it in GitHub Desktop.
Development NGINX config
# Added to the end of fastcgi_params
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
#user nobody;
worker_processes 1;
error_log /usr/local/logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 128M;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
upstream php {
server 127.0.0.1:9000;
}
include /usr/local/etc/nginx/sites/*.conf;
}
# A vhost that handles React/javascript style applications
# that have a router prefix of /p/
server {
listen 80;
server_name portal.tim;
root /Users/tim/Sites/$host;
location = / {
return 301 /p/;
}
location ~ ^/p/ {
try_files /index.html /index.html;
}
}
server {
listen 443 ssl;
server_name portal.tim;
ssl_certificate /Users/tim/Sites/wildcard.tim.crt;
ssl_certificate_key /Users/tim/Sites/wildcard.tim.key;
charset utf-8;
root /Users/tim/Sites/$host;
location = / {
return 301 /p/;
}
location ~ ^/p/ {
try_files /index.html /index.html;
}
}
# Runs any php
server {
listen 80;
server_name graphs.tim;
root /Users/tim/Sites/$host/web;
location ~ \.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}
}
server {
listen 443 ssl;
server_name graphs.tim;
ssl_certificate /Users/tim/Sites/wildcard.tim.crt;
ssl_certificate_key /Users/tim/Sites/wildcard.tim.key;
root /Users/tim/Sites/$host/web;
location ~ \.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
}
}
# A default symfony2 vhost for 80 and 443
server {
listen 80 default_server;
server_name _;
root /Users/tim/Sites/$host/web;
location = / {
try_files @site @site;
}
location / {
try_files $uri $uri/ @site;
}
location ~ \.php$ {
return 404;
}
location @site {
fastcgi_pass php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/app_dev.php;
}
}
server {
listen 443 ssl default_server;
server_name localhost _;
ssl_certificate /Users/tim/Sites/wildcard.tim.crt;
ssl_certificate_key /Users/tim/Sites/wildcard.tim.key;
root /Users/tim/Sites/$host/web;
location = / {
try_files @site @site;
}
location / {
try_files $uri $uri/ @site;
}
location ~ \.php$ {
return 404;
}
location @site {
fastcgi_pass php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/app_dev.php;
fastcgi_param HTTPS on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment