Smart compact vhost config for nginx Webserver as HTTPS-Proxy for Plone CMS

Nginx is one of the most used webserver/proxy in front of Plone CMS. This example showes how to setup a compact virtual host for Plone.

The following nginx vhost configuration applies to "" and "". And does a redirect for the non-www domain to the www-version.

The first too rewrites are taking care of the NON-WWW to WWW and HTTP to HTTPS redirects, by using only the host and server_name variables. This make it very easy to reuse for other vhosts.

The proxy_pass does the VirtualHostRoot rewriting and includes the Plone-site-id, which in this case is "Plone".

server {
    listen ssl;
    ssl_certificate /etc/ssl/;
    ssl_certificate_key /etc/ssl/;
    if ( $host != $server_name ) {
        return 301 $scheme://$server_name$request_uri;

    if ( $scheme != "https") {
        rewrite ^ https://$host$uri permanent;

    proxy_read_timeout 300;
    location / {

By @MrTango in
Tags :