Skip to content

Instantly share code, notes, and snippets.

@skcin7
Forked from JesseObrien/name.conf
Created October 12, 2013 00:49
Show Gist options
  • Save skcin7/6944256 to your computer and use it in GitHub Desktop.
Save skcin7/6944256 to your computer and use it in GitHub Desktop.
server{
listen 80;
server_name example.com www.example.com;
access_log /var/log/nginx/mysite.access.log;
root /myproject/public;
index index.php index.htm index.html;
gzip on;
gzip_static on;
gzip_http_version 1.0;
gzip_disable "MSIE [1-6].";
gzip_vary on;
gzip_comp_level 9;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.php$ {
root /myproject/public;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment