Created
May 24, 2012 13:42
-
-
Save amcgregor/2781607 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /home/<client>/etc/nginx/<appname>.conf | |
server { | |
server_name example.com www.example.com; | |
listen 80; | |
access_log /home/<client>/var/log/<appname>-access.log combined; | |
error_log /home/<client>/var/log/<appname>-error.log error; | |
root /home/<client>/apps/<appname>; | |
include app/php.conf; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /home/<client>/etc/nginx/<appname>.conf | |
upstream appname { | |
server unix:/home/<client>/var/run/<appname>.sock-1; | |
server unix:/home/<client>/var/run/<appname>.sock-2; | |
} | |
server { | |
server_name example.com www.example.com; | |
listen 80; | |
access_log /home/<client>/var/log/<appname>-access.log combined; | |
error_log /home/<client>/var/log/<appname>-error.log error; | |
root /home/<client>/apps/<appname>/virtualroot; | |
try_files $uri app; | |
location @app { | |
include core/fcgi.conf; | |
fastcgi_param SCRIPT_NAME ""; | |
fastcgi_pass appname; | |
access_log /home/<client>/var/log/<appname>-perf.log timing; | |
access_log /home/<client>/var/log/<appname>-info.log up_head; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/core/fastcgi.conf | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param QUERY_STRING $query_string; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param REQUEST_URI $request_uri; | |
fastcgi_param DOCUMENT_URI $document_uri; | |
fastcgi_param DOCUMENT_ROOT $document_root; | |
fastcgi_param SERVER_PROTOCOL $server_protocol; | |
fastcgi_param GATEWAY_INTERFACE CGI/1.1; | |
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | |
fastcgi_param REMOTE_ADDR $remote_addr; | |
fastcgi_param REMOTE_PORT $remote_port; | |
fastcgi_param SERVER_ADDR $server_addr; | |
fastcgi_param SERVER_PORT $server_port; | |
fastcgi_param SERVER_NAME $server_name; | |
fastcgi_param AUTH_USER $remote_user; | |
fastcgi_param REMOTE_USER $remote_user; | |
# PHP only, required if PHP was built with --enable-force-cgi-redirect | |
# fastcgi_param REDIRECT_STATUS 200; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/nginx.conf | |
user nginx nginx; | |
worker_processes 1; | |
pid /var/run/nginx.pid; | |
error_log /var/log/nginx/error_log info; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} | |
http { | |
include core/mimetypes.conf; | |
default_type application/octet-stream; | |
# log_format error '[$time_local] [error] [client $remote_addr] '; | |
# log_format common '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent'; | |
# log_format combined '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"'; | |
# log_format download '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_range" "$sent_http_content_range"'; | |
log_format main | |
'$remote_addr - $remote_user [$time_local] ' | |
'"$request" $status $bytes_sent ' | |
'"$http_referer" "$http_user_agent" ' | |
'"$gzip_ratio"'; | |
client_max_body_size 64M; | |
client_header_timeout 10m; | |
client_body_timeout 10m; | |
send_timeout 10m; | |
connection_pool_size 256; | |
client_header_buffer_size 1k; | |
large_client_header_buffers 4 2k; | |
request_pool_size 4k; | |
gzip on; | |
gzip_min_length 1100; | |
gzip_buffers 4 8k; | |
gzip_types text/plain text/css text/javascript application/javascript application/x-javascript application/json text/xml application/xml application/rdf+xml; | |
output_buffers 1 32k; | |
postpone_output 1460; | |
sendfile on; | |
tcp_nopush on; | |
tcp_nodelay on; | |
keepalive_timeout 75 20; | |
ignore_invalid_headers on; | |
index index.html; | |
include default.conf; | |
include /home/*/etc/nginx/*.conf; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/app/php.conf | |
index index.html index.php; | |
include app/static.conf; | |
location ~ \.php($|/) { | |
fastcgi_pass unix:/var/run/php-fcgi.sock-1; | |
fastcgi_index index.php; | |
fastcgi_split_path_info ^(.+\.php)(.*)$; | |
fastcgi_param PATH_INFO $fastcgi_path_info; | |
include core/fastcgi.conf; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/nginx/app/static.conf | |
autoindex off; | |
charset utf8; | |
location ~ \.flv$ { flv; } | |
location ~ /favicon.ico { error_log none; } | |
location ~ /robots.txt { error_log none; } | |
location ~ /\.ht { deny all; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment