Skip to content

Instantly share code, notes, and snippets.

@jeremymarc
Last active December 16, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeremymarc/5448381 to your computer and use it in GitHub Desktop.
Save jeremymarc/5448381 to your computer and use it in GitHub Desktop.
upstream backend {
server unix:/var/run/domain.sock;
}
server {
listen 80 default;
server_name domain.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443 default spdy;
root /home/domain/www/current/web;
index app.php;
autoindex off;
server_name domain.com;
ssl on;
ssl_certificate /etc/nginx/domain.com.crt;
ssl_certificate_key /etc/nginx/domain.com.key;
access_log /var/log/nginx/domain.com.access.log;
error_log /var/log/nginx/domain.com.error.log;
location / {
try_files $uri /app.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass backend;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ $/(php_status|php_ping)$ {
fastcgi_pass backend;
include fastcgi_params;
allow 127.0.0.1;
deny all;
}
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
# deny access to .htaccess files, since we have some of them
location ~ /\.ht {
deny all;
}
location ~ ^/v/[^/]+(/.*) {
try_file $uri $1;
expires max;
add_header Cache-Control public;
gzip on;
gzip_disable "msie6";
gzip_types text/css text/javascript application/javascript application/x-javascript;
gzip_vary on;
}
location ~* \.(ttf|ttc|otf|eot|woff|font.css)$ {
add_header "Access-Control-Allow-Origin" "*";
}
location ~* \.(js|css) {
expires max;
add_header Cache-Control public;
gzip on;
gzip_disable "msie6";
gzip_types text/css text/javascript application/javascript application/x-javascript;
gzip_vary on;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment