Skip to content

Instantly share code, notes, and snippets.

@atsu666
Created September 6, 2019 01:46
Show Gist options
  • Save atsu666/b655ae72a470e5ff65058bbab675b6fb to your computer and use it in GitHub Desktop.
Save atsu666/b655ae72a470e5ff65058bbab675b6fb to your computer and use it in GitHub Desktop.
a-blog cms for nginx
server {
server_name example.com;
root /var/www/html;
location ~ ^/(private|themes|extension)/ {
return 403;
}
# Block access to "hidden" files.
location ~ (^|/)\. {
return 403;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 14d;
}
location / {
if (-e $request_filename) { break; }
rewrite (.*(^|/)[^\./]+)$ $1/ permanent;
rewrite ((\.(html|htm|php|xml|txt|js|json|css|yaml|csv))|/)$ /index.php last;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:8080;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PAHT_INFO $fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment