Skip to content

Instantly share code, notes, and snippets.

@vuchl
Created October 20, 2014 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vuchl/c503cb861d538dc36fc6 to your computer and use it in GitHub Desktop.
Save vuchl/c503cb861d538dc36fc6 to your computer and use it in GitHub Desktop.
configuration file for Bolt 2 CMS on NGINX + PHP-FPM
server {
listen 80;
server_name mycoolsite.com www.mycoolsite.com;
root /home/mycoolsite.com/public_html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
# pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
location ~ \.php$ {
try_files $uri /index.php =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;
}
location ~* /thumbs/(.*)$ {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* /async/(.*)$ {
try_files $uri $uri/ /index.php?$query_string;
}
location /app/classes/upload {
try_files $uri $uri/ /app/classes/upload/index.php?$query_string;
}
# If you set a custom branding path, you will need to change '/bolt/' here to match
location ~* /bolt/(.*)$ {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)$ {
access_log off;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
}
location = /robots.txt { access_log off; log_not_found off; }
location = /favicon.ico { access_log off; log_not_found off; }
location ~ /\.ht {
deny all;
}
location /app {
deny all;
}
location ~ /vendor {
deny all;
}
location ~ \.db$ {
deny all;
}
location ~ \.yml$ {
deny all;
}
location ~ \.twig$ {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment