Skip to content

Instantly share code, notes, and snippets.

@larrybotha
Last active August 29, 2015 14:01
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 larrybotha/0b40837d489a0f5d2439 to your computer and use it in GitHub Desktop.
Save larrybotha/0b40837d489a0f5d2439 to your computer and use it in GitHub Desktop.
Nginx site specific configs.

Nginx Configs For Homebrew Install

A list of configs specific to different environments.

Found at /usr/local/etc/nginx/

# sites-available/
server {
listen 80;
server_name localhost;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
# sites-available/
server {
listen 443;
server_name localhost;
ssl on;
ssl_certificate server.crt;
ssl_certificate_key server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
# /
# user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
include conf.d/*.conf;
include sites-enabled/*;
sendfile on;
keepalive_timeout 65;
}
# conf.d/
# tell php requests to be sent to where php-fpm is listening
upstream php {
server 127.0.0.1:9000;
}
# sites-enabled/
server {
server_name phppgadmin.dev;
access_log /usr/local/var/log/nginx/phppgadmin.access.log;
error_log /usr/local/var/log/nginx/phppgadmin.error.log;
location / {
root /Users/larry/Server/phppgadmin;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /Users/larry/Server/phppgadmin;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# sites-enabled/
server {
server_name sample.dev;
access_log /usr/local/var/log/nginx/sample.access.log;
error_log /usr/local/var/log/nginx/sample.error.log;
root /Users/larry/Server/sample;
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?q=$uri&$args;
location ~ \.php$ {
root /Users/larry/Server/sample;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
try_files $uri $uri/ /index.php?it=$uri&$args;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment