location PATHTOCHANGE { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } try_files $uri @YNH_APP_INSTANCE_NAME; } location /protected/ { internal; alias /opt/YNH_APP_INSTANCE_NAME/YNH_APP_INSTANCE_NAME/smedia/; } location PATHTOCHANGEmedia { alias /opt/YNH_APP_INSTANCE_NAME/media; } location PATHTOCHANGEstatic { alias /opt/YNH_APP_INSTANCE_NAME/static; } location PATHTOCHANGEassets { alias /opt/YNH_APP_INSTANCE_NAME/static; } location @YNH_APP_INSTANCE_NAME { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass http://unix:/opt/YNH_APP_INSTANCE_NAME/sock; }