Skip to content

Instantly share code, notes, and snippets.

@jeffsebring
Created July 26, 2012 07:27
Show Gist options
  • Save jeffsebring/3180752 to your computer and use it in GitHub Desktop.
Save jeffsebring/3180752 to your computer and use it in GitHub Desktop.
Example nginx config
server {
server_name www.jeffsebring.com;
rewrite ^/(.*)$ http://jeffsebring.com/$1 permanent;
}
server {
#port 8080;
server_name jeffsebring.com;
access_log /PATH/logs/access/jeffsebring.com_access.log;
error_log /PATH/logs/errors/jeffsebring.com_error.log;
root /PATH/www/jeffsebring.com;
port_in_redirect off;
gzip on;
gzip_comp_level 9;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xhtml+xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6]\.";
location ~ /\.ht[a-z]+$ {
deny all;
}
location ~ \.(jpe?g|gif|png|css|bmp|js|ico|eot|woff|ttf)$ {
expires 30d;
}
if ( $request_filename ~ linked/.+\ ) {
rewrite ^(.*) http://jeffsebring.com$1 permanent;
}
location / {
index.php index.html;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
}
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment