Skip to content

Instantly share code, notes, and snippets.

@blt
Created July 14, 2011 15:34
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 blt/1082690 to your computer and use it in GitHub Desktop.
Save blt/1082690 to your computer and use it in GitHub Desktop.
server {
listen 80; ## listen for ipv4; this line is default and implied
root /var/www/domains/example.com/docdir/;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name app0.example.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html /index.php;
}
error_page 404 /404.html;
# pass the PHP scripts to FastCGI server
location ~ \.php$ {
fastcgi_pass unix:/tmp/example_php-fpm.socket;
fastcgi_index index.php;
include fastcgi_params;
}
}
[example.com]
listen = /tmp/example-fpm.socket
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
user = www-data
group = www-data
pm = dynamic
pm.max_requests = 0
pm.max_children = 2
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1
pm.status_path = /php_pool_example.com_status
request_terminate_timeout = 2
request_slowlog_timeout = 1
slowlog = /var/www/domains/example.com/logs/php-slow.log
chroot = /var/www/domains/example.com
; Chdir to this directory at the start. This value must be an absolute path.
; Default Value: current directory or / when chroot
chdir = /docdir/
catch_workers_output = yes
env[HOSTNAME] = $HOSTNAME
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
php_flag[display_errors] = on
php_admin_value[error_log] = /logs/php_err.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 1M
php_value[max_execution_time] = 2
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_FILENAME $uri;
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;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment