Skip to content

Instantly share code, notes, and snippets.

@bangonkali
Created November 27, 2015 12:24
Show Gist options
  • Save bangonkali/07fe25b4821b62cfbee0 to your computer and use it in GitHub Desktop.
Save bangonkali/07fe25b4821b62cfbee0 to your computer and use it in GitHub Desktop.
# HTTP Server
server {
listen 0.0.0.0:80;
server_name edu.acomsys.net;
server_name_in_redirect off;
root /var/www/edu.acomsys.net;
index index.php index.html index.htm;
access_log /var/log/nginx/edu.acomsys.net.access;
error_log /var/log/nginx/edu.acomsys.net.error info;
location / {
# try_files $uri $uri/ /index.html;
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 3600;
}
# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}
location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}
gzip on;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_types text/plain application/xhtml+xml text/css application/xml application/xml+rss text/javascript application/javascript application/x-javascript
gzip_proxied any;
gzip_disable "MSIE [1-6]\.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment