Usage

  • Disable .git
1
2
3
location ~ /.git/ {
deny all;
}

Hugo

  • build && upload
1
2
$ hugo -D --minify
$ rsync -avz --delete public/ deploy@www.yoursite.com:/var/www/www.yoursite.com/htdocs
  • nginx.conf
1
2
3
4
5
6
7
8
server {
    listen 80;
    index index.html;
    gzip on;

    root /var/www/www.yoursite.com/htdocs;
    server_name www.yoursite.com;
}

Rust & React

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
server {
  listen 80;

  server_name www.yoursite.com;
  access_log /var/log/nginx/www.yoursite.com.access.log;
  error_log  /var/log/nginx/www.yoursite.com.error.log;

  location /my/ {
    alias /var/www/www.yoursite.com/dashboard/;
    try_files $uri $uri/ /my/index.html;
  }
  location /3rd/ {
    alias /var/www/www.yoursite.com/node_modules/;
  }
  location /assets/ {
    alias /var/www/www.yoursite.com/assets/;
  }
  location /upload/ {
    alias /var/www/www.yoursite.com/tmp/upload/;
  }

  location / {
    proxy_set_header X-Forwarded-Proto http;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://localhost:8080;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
  }
}

Certbot

  • renew manualy
1
sudo certbot --nginx
  • auto renew, add to crontab sudo crontab -e
1
2
0 0 1 * * /usr/bin/certbot renew --force-renewal
5 0 1 * * /usr/sbin/service nginx restart

Resources