Created
November 23, 2016 17:17
-
-
Save hvelarde/3ab42d94be6e02a935c0be9fc6d77547 to your computer and use it in GitHub Desktop.
nginx configuration for Plone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration file for nginx | |
# | |
# This file must me symlinked to /etc/nginx/sites-enabled/default | |
upstream plone { | |
server localhost:8081; | |
server localhost:8082; | |
} | |
server { | |
listen 80; | |
server_name example.com; | |
rewrite ^/(.*) http://www.example.com/$1 permanent; | |
} | |
server { | |
listen 80 default_server; | |
server_name www.example.com; | |
client_max_body_size 10M; | |
if ($request_method !~ ^(GET|POST|HEAD)$) { | |
return 405; | |
} | |
location / { | |
if ($request_uri ~* ".(avi|css|flv|gif|gz|htc|ico|jpeg|jpg|js|mov|mp3|mpeg|mpg|png|rar|swf|txt|wmv|woff|woff2|zip)$") { | |
expires 7d; | |
} | |
proxy_cache backcache; | |
proxy_cache_bypass $http_cache_control $cookie___ac; | |
add_header X-Proxy-Cache $upstream_cache_status; | |
proxy_pass http://plone/VirtualHostBase/http/www.example.com:80/Plone/VirtualHostRoot/; | |
proxy_http_version 1.1; | |
proxy_set_header Connection ""; | |
proxy_ignore_headers Expires; | |
} | |
location ~ /manage(_.+)?$ { | |
deny all; | |
} | |
location ~ \.php$ { | |
return 410; | |
access_log off; | |
} | |
location ~ ^/(wp-admin|wp-content) { | |
return 410; | |
access_log off; | |
} | |
location = /nginx_stub_status { | |
stub_status on; | |
allow 127.0.0.1; | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment