Skip to content

Instantly share code, notes, and snippets.

@juev
Forked from centminmod/gist:8935394
Last active August 29, 2015 14:06
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 juev/b2ab88ac6ce74487774a to your computer and use it in GitHub Desktop.
Save juev/b2ab88ac6ce74487774a to your computer and use it in GitHub Desktop.
server {
server_name yourghostdomain.com www.yourghostdomain.com;
access_log /home/nginx/domains/yourghostdomain.com/log/access.log combined buffer=32k;
error_log /home/nginx/domains/yourghostdomain.com/log/error.log;
root /home/nginx/domains/yourghostdomain.com/public;
location /blog {
include /home/nginx/domains/yourghostdomain.com/proxy.conf;
include /home/nginx/domains/yourghostdomain.com/proxycache.conf; }
location ~ ^/blog/(googled37bfa97c8831518.html) {
root /home/nginx/domains/yourghostdomain.com/public/blog; include /usr/local/nginx/conf/staticfiles.conf; }
location ~ ^/blog/(BingSiteAuth.xml) {
root /home/nginx/domains/yourghostdomain.com/public/blog; }
location ~ ^/blog/(mu-05496000-764f244f-c134ebbc-f206d313.txt) {
root /home/nginx/domains/yourghostdomain.com/public/blog; include /usr/local/nginx/conf/staticfiles.conf; }
location ~ ^/blog/(loaderio-a8b088d850abe516ad0052d1113f6b77.txt) {
root /home/nginx/domains/yourghostdomain.com/public/blog; include /usr/local/nginx/conf/staticfiles.conf; }
location ~ ^/blog/(robots.txt) {
root /home/nginx/domains/yourghostdomain.com/public/blog; }
location ~ ^/blog/(sitemap.xml) {
root /home/nginx/domains/yourghostdomain.com/public/blog; }
location = /blog/atom.xml {
rewrite ^ $scheme://yourghostdomain.com/blog/rss/ permanent; }
location ~ ^/blog/ghost/(img|css|fonts)/ {
include /home/nginx/domains/yourghostdomain.com/proxy.conf;
include /home/nginx/domains/yourghostdomain.com/proxycache.conf; }
location ~ ^/blog/(ghost/) {
allow 127.0.0.1; allow 111.222.333.444; deny all;
# redirect ghost admin page to secure SSL https
rewrite ^/(.*)$ https://yourghostdomain.com/$1 permanent; }
#location ~ ^/blog/(ghost/signup/) {
# redirect signup page to index page for security
# after initial admin account has been setup
#rewrite ^/(.*)$ http://yourghostdomain.com permanent; }
location ~ ^/blog/ghost/ {
allow 127.0.0.1; allow 111.222.333.444; deny all;
# password protect ghost admin pages
auth_basic "Private";
auth_basic_user_file /usr/local/nginx/conf/ghostpasswd;
include /home/nginx/domains/yourghostdomain.com/proxy.conf; }
location ~ ^/blog/signout/ {
allow 127.0.0.1; allow 111.222.333.444; deny all;
# nginx proxy_cache disable for logout
include /home/nginx/domains/yourghostdomain.com/proxy.conf; }
location /blog/assets/css/ {
# offload ghost css files to Nginx web server
root /home/nginx/domains/yourghostdomain.com/ghost/content/themes/casper;
include /home/nginx/domains/yourghostdomain.com/concat.conf; }
location /blog/assets/js/ {
# offload ghost jsfiles to Nginx web server
root /home/nginx/domains/yourghostdomain.com/ghost/content/themes/casper;
include /home/nginx/domains/yourghostdomain.com/concat.conf; }
location /blog/assets/fonts/ {
# offload ghost fonts to Nginx web server
root /home/nginx/domains/yourghostdomain.com/ghost/content/themes/casper;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
access_log off; expires 30d; }
location ~ ^/blog/(shared/|built/) {
# offload ghost files to Nginx web server
root /home/nginx/domains/yourghostdomain.com/ghost/core;
access_log off; expires 30d; }
location ~ ^/blog/(favicon.ico) {
# offload ghost files to Nginx web server
root /home/nginx/domains/yourghostdomain.com/ghost/core/shared;
access_log off; expires 30d; }
location ~ ^/blog/(content/images/) {
# offload ghost files to Nginx web server
root /home/nginx/domains/yourghostdomain.com/ghost;
access_log off; expires 30d; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment