41 lines
1.1 KiB
Bash
41 lines
1.1 KiB
Bash
#!/bin/bash
|
|
certbot certonly --webroot -w /var/www/html -d agent.wooo.work --non-interactive --agree-tos --account 957a0a8ba3c1393f153d98b8aa7e6c07
|
|
|
|
cat << 'NGINX_CONF_SSL' > /etc/nginx/sites-available/agent.wooo.work.conf
|
|
server {
|
|
listen 80;
|
|
server_name agent.wooo.work;
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/html;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name agent.wooo.work;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/agent.wooo.work/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/agent.wooo.work/privkey.pem;
|
|
|
|
location / {
|
|
proxy_pass http://192.168.0.110;
|
|
proxy_http_version 1.1;
|
|
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-Proto $scheme;
|
|
|
|
# WebSocket support
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
}
|
|
NGINX_CONF_SSL
|
|
|
|
nginx -t && systemctl reload nginx
|