nginx + acme 不占用80端口申请证书
1.在你的域名conf
里配置如下
server {
listen 80;
listen [::]:80;
server_name your_domain.com; # ← 改为你的域名或IP
location ^~ /.well-known/acme-challenge/ {
root /var/www/acme;
default_type "text/plain";
}
location / {
return 301 https://$host$request_uri;
}
}
确保/var/www/acme
有这个路径文件夹,然后执行证书申请
mkdir -p /var/www/acme
~/.acme.sh/acme.sh --issue -d your_domain.com --webroot /var/www/acme
#或者 后面的端口号随意,确保防火墙打开的
~/.acme.sh/acme.sh --issue -d your_domain.com --standalone --httpport 8181
License:
CC BY 4.0