apt install nginx certbot python3-certbot-nginx -y
cd /etc/nginx/sites-enabled
vim site01.conf
server {
server_name app.site01.com;
set $upstream 127.0.0.1:5000;
underscores_in_headers on;
location /.well-known {
alias /var/www/ssl-proof/.well-known;
}
location / {
proxy_pass_header Authorization;
proxy_pass http://$upstream;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ssl on; # Optional
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection “”;
proxy_buffering off;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
}
}
Para checar as sintaxes do arquivo de configuração, execute:
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
certbot --nginx -d site01.com -d app.site01.com