server { listen 80; server_name www.{{ app_domain_name }}; # $scheme will get the http protocol # and 301 is best practice for tablet, phone, desktop and seo return 301 $scheme://{{ app_domain_name }}$request_uri; } server { listen 80; server_name {{ app_domain_name }}; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root {{ app_dir }}; } location /media/ { root {{ app_dir }}; } location / { proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 10; proxy_read_timeout 10; proxy_pass http://localhost:{{ app_port }}/; } }