Skip to content

Instantly share code, notes, and snippets.

@rubensayshi
Last active August 29, 2015 13:59
Show Gist options
  • Save rubensayshi/10974113 to your computer and use it in GitHub Desktop.
Save rubensayshi/10974113 to your computer and use it in GitHub Desktop.
nginx localhost
user www-data;
worker_processes 2;
pid /run/nginx.pid;
events {
worker_connections 768;
multi_accept on;
user epoll;
}
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
keepalive_timeout 0;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
upstream php5-fpm-sock {
server unix:/var/run/php5-fpm.sock;
}
include /etc/nginx/sites-enabled/*;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
error_log /var/log/nginx/localhost.error.log;
client_max_body_size 4M;
client_body_buffer_size 128k;
expires 24h;
location / {
root /var/www;
index index.php index.html;
# if file exists return it right away
if (-f $request_filename) {
break;
}
if (-e $request_filename) {
break;
}
# Useful rewrite for most frameworks, wordpress
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php last;
break;
}
}
location ~ \.php$ {
expires off;
include /etc/nginx/fastcgi_params;
fastcgi_pass php5-fpm-sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
}
}
[www]
listen = /var/run/php5-fpm.sock
user = www-data
group = www-data
pm = static
pm.max_children = 5
php_admin_value[memory_limit] = 256M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment