I follow this tutorial Plone Deplayoing Nginx and created config file in NGINX:
add_header X-Content-Type-Options "nosniff";
#add_header Content-Security-Policy "default-src 'self'; img-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'";
add_header Content-Security-Policy-Report-Only "default-src 'self'; img-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'";
# This specifies which IP and port Plone is running on.
# The default is 127.0.0.1:8080
upstream plone {
server 127.0.0.1:8081;
}
# Redirect all www-less traffic to the www.site.com domain
# (you could also do the opposite www -> non-www domain)
server {
listen 80;
server_name asp.pro.br;
rewrite ^/(.*) http://www.asp.pro.br/$1 permanent;
}
server {
listen 80;
server_name www.asp.pro.br;
access_log /var/log/nginx/asp.pro.br.access.log;
error_log /var/log/nginx/asp.pro.br.error.log;
# Note that domain name spelling in VirtualHostBase URL matters
# -> this is what Plone sees as the "real" HTTP request URL.
# "Plone" in the URL is your site id (case sensitive)
location / {
proxy_pass http://127.0.0.1:8081/VirtualHostBase/http/asp.pro.br:80/aspax/Portal/VirtualHostRoot/;
}
}
But when open in browser the imagens don't load, how can I fix it?
[SOLUTION]
When DNS send WWW you must set up in proxy_pass:
proxy_pass http://127.0.0.1:8081/VirtualHostBase/http/asp.pro.br:80/aspax/Portal/VirtualHostRoot/;
Let's first try to find out if, your Plone is working fine with images. For that you should call it directly without any proxy like nginx in front. If images are working, then we have to fix your nginx config. Trying without your Content-Security-Policy part in nginx, to see if it works without that, would e my next step. Every application works differently, therefor we should focus on what we need for Plone to run. And lucky you, that is not much. If Plone was working in this setup with Squid, than it might be the nginx config. Here are a working one:
or with https:
The site id here, is "Plone", for it is "aspax".
Make sure that your hostname in the proxy_pass directive is the same as for your server_name. That includes the www in your example.
An a bit more advanced and compact example can be found here: http://mrtango.planetcrazy.de/smart-compact-vhost-config-for-nginx-webserver-as-https-proxy-for-plone-cms.html