Hi Matic,

This is an Nginx question and has nothing to do with Mezzanine (or Django).
https://www.digitalocean.com/community/questions/redirecting-non-www-to-www-in-nginx
provides a quick solution to your problem.

hth!

-ken

On Mon, Sep 4, 2017 at 8:13 AM, Matic Noč <greensu...@gmail.com> wrote:

> Helllo,
>
> I have two questions.
> 1) On my deployed mezzanine I cannot find nginx conf. file (etc/nginx/
>  repo).
> 2) I have two domains "DOMAINS": ["www.example.com", "example.com"], in
> my fab file, and I want to edit ngnix.conf.template file so it will be able
> to redirect 301 the non www domains to www, but the problem is that
> mezzanine deploy makes only one server. Is it possible to add redirect
> inside the template somehow?
>
> server {
>
>     listen 80;
>     %(ssl_disabled)s listen 443 ssl;
>     server_name %(domains_nginx)s;
>     client_max_body_size 35M;
>     keepalive_timeout    15;
>     error_log /home/%(user)s/logs/%(proj_name)s_error_nginx.log info;
>
>     %(ssl_disabled)s ssl_certificate      conf/%(proj_name)s.crt;
>     %(ssl_disabled)s ssl_certificate_key  conf/%(proj_name)s.key;
>     %(ssl_disabled)s ssl_session_cache    shared:SSL:10m;
>     %(ssl_disabled)s ssl_session_timeout  10m;
>     %(ssl_disabled)s ssl_ciphers 
> ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;
>     %(ssl_disabled)s ssl_prefer_server_ciphers on;
>     %(ssl_disabled)s ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
>
>     # Deny illegal Host headers
>     if ($host !~* ^(%(domains_regex)s)$) {
>         return 444;
>     }
>
>     location / {
>         proxy_redirect      off;
>         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-Protocol    $scheme;
>         proxy_pass          http://%(proj_name)s;
>     }
>
>     location /static/ {
>         root            %(proj_path)s;
>         access_log      off;
>         log_not_found   off;
>         expires 30d;
>     }
>
>     location /robots.txt {
>         root            %(proj_path)s/static;
>         access_log      off;
>         log_not_found   off;
>     }
>
>     location /favicon.ico {
>         root            %(proj_path)s/static/img;
>         access_log      off;
>         log_not_found   off;
>     }
>
> }
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to