Skip to content

Latest commit

 

History

History
109 lines (88 loc) · 3.38 KB

server.md

File metadata and controls

109 lines (88 loc) · 3.38 KB

PHX - Server

« Back

Setup

Nginx configs

# http redirect
server {
  listen 80;
  listen [::]:80;

  server_name [URL].co.uk www.[URL].co.uk;
  return 301 https://[URL].co.uk$request_uri;
}

# www redirect
server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  ssl_certificate /etc/letsencrypt/live/[URL].co.uk/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/[URL].co.uk/privkey.pem;

  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

  # https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-with-http-2-support-on-ubuntu-18-04
  ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

  server_name www.[URL].co.uk;
  return 301 https://[URL].co.uk$request_uri;
}

# server
server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  ssl_certificate /etc/letsencrypt/live/[URL].co.uk/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/[URL].co.uk/privkey.pem;

  ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

  # https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-with-http-2-support-on-ubuntu-18-04
  ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

  server_name [URL].co.uk;

  location = /favicon.ico { access_log off; log_not_found off; }

  # Django static files
  location /static/ {
    root /home/phx/phx;
  }

  # Django admin uploads
  location /media/ {
    root /home/phx/phx;
  }

  # Django
  location / {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;
  }
}