Skip to content

Instantly share code, notes, and snippets.

@jackmcdade
Created August 23, 2016 17:04
Show Gist options
  • Save jackmcdade/a578a29f8acd80d762629e56a22d0dbc to your computer and use it in GitHub Desktop.
Save jackmcdade/a578a29f8acd80d762629e56a22d0dbc to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name example.com;
root /var/www/example.com/public/;
ssl_protocols TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
location = / {
try_files /static/index.html /index.php?$query_string;
}
location / {
try_files $uri $uri/ /static/$uri /static/$uri/index.html /static/ $uri /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/example.com-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
@jackmcdade
Copy link
Author

Tinkering with this. Thanks! Do you know if it's possible to only do these static try_files rules if the $request_method is GET?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment