Skip to content

Instantly share code, notes, and snippets.

@ultramcu
Created July 11, 2013 06:02
Show Gist options
  • Save ultramcu/5972899 to your computer and use it in GitHub Desktop.
Save ultramcu/5972899 to your computer and use it in GitHub Desktop.
example nginx config file
server {
listen 80;
root /var/www/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name miiniq.com;
location = /robots.txt { access_log off; log_not_found off; }
location ~ ~$ { access_log off; log_not_found off; deny all; }
location ~* .(js|css|png|jpg|jpeg|gif|ico|xml|swf|flv|eot|ttf|woff|pdf|xls|htc)$ {
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off;
log_not_found off;
expires 360d;
}
location / {
index index.html index.php;
try_files $uri /index.php?$args;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /.ht {
deny all;
access_log off;
log_not_found off;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment