<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>HTTPS on Daniel Zhang</title><link>https://zhangdapeng.dev/tags/https/</link><description>Recent content in HTTPS on Daniel Zhang</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Fri, 27 Nov 2026 09:00:00 +0800</lastBuildDate><atom:link href="https://zhangdapeng.dev/tags/https/index.xml" rel="self" type="application/rss+xml"/><item><title>Managing Wildcard SSL Certificates with acme.sh: DNS Validation and Nginx Deployment</title><link>https://zhangdapeng.dev/p/managing-wildcard-ssl-certificates-with-acme.sh-dns-validation-and-nginx-deployment/</link><pubDate>Fri, 27 Nov 2026 09:00:00 +0800</pubDate><guid>https://zhangdapeng.dev/p/managing-wildcard-ssl-certificates-with-acme.sh-dns-validation-and-nginx-deployment/</guid><description>&lt;img src="https://zhangdapeng.dev/p/managing-wildcard-ssl-certificates-with-acme.sh-dns-validation-and-nginx-deployment/cover.png" alt="Featured image of post Managing Wildcard SSL Certificates with acme.sh: DNS Validation and Nginx Deployment" /&gt;&lt;h1 id="managing-wildcard-ssl-certificates-with-acmesh"&gt;Managing Wildcard SSL Certificates with acme.sh
&lt;/h1&gt;&lt;p&gt;When deploying websites or configuring Nginx reverse proxies, SSL/TLS certificates are essential for enabling secure HTTPS connections.&lt;/p&gt;
&lt;p&gt;Consider a domain with multiple subdomains:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;example.com&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://www.example.com" target="_blank" rel="noopener"
 &gt;www.example.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;api.example.com&lt;/li&gt;
&lt;li&gt;admin.example.com&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Managing individual certificates for every subdomain can become inconvenient, especially when it comes to renewal and deployment.&lt;/p&gt;
&lt;p&gt;A wildcard SSL certificate provides a more convenient solution. It allows a single certificate to cover a primary domain and its matching first-level subdomains.&lt;/p&gt;
&lt;p&gt;In this article, we will explore how to use &lt;strong&gt;acme.sh, Let&amp;rsquo;s Encrypt, and Nginx&lt;/strong&gt; to issue and deploy wildcard certificates.&lt;/p&gt;
&lt;p&gt;We will also cover manual DNS validation without API credentials, network considerations for servers in mainland China, and permission management when running acme.sh as a non-root user.&lt;/p&gt;
&lt;h2 id="1-what-is-acmesh"&gt;1. What Is acme.sh?
&lt;/h2&gt;&lt;p&gt;&lt;a class="link" href="https://github.com/acmesh-official/acme.sh" target="_blank" rel="noopener"
 &gt;acme.sh&lt;/a&gt; is an open-source ACME client written entirely in Shell.&lt;/p&gt;
&lt;p&gt;It automates the process of issuing, renewing, and deploying SSL/TLS certificates.&lt;/p&gt;
&lt;p&gt;Its main features include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight implementation with minimal dependencies.&lt;/li&gt;
&lt;li&gt;Support for Let&amp;rsquo;s Encrypt, ZeroSSL, and other certificate authorities.&lt;/li&gt;
&lt;li&gt;Support for single-domain, multi-domain, and wildcard certificates.&lt;/li&gt;
&lt;li&gt;HTTP and DNS validation methods.&lt;/li&gt;
&lt;li&gt;DNS API integrations with many DNS providers.&lt;/li&gt;
&lt;li&gt;Automated certificate deployment to Nginx and Apache.&lt;/li&gt;
&lt;li&gt;Scheduled renewal checks.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For developers managing multiple domains or subdomains, acme.sh provides a convenient certificate management solution.&lt;/p&gt;
&lt;h2 id="2-installing-acmesh"&gt;2. Installing acme.sh
&lt;/h2&gt;&lt;p&gt;First, install the required dependencies.&lt;/p&gt;
&lt;p&gt;For Ubuntu or Debian:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt update
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo apt install -y curl git cron
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Under normal network conditions, you can use the official installation script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl https://get.acme.sh &lt;span class="p"&gt;|&lt;/span&gt; sh -s &lt;span class="nv"&gt;email&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your_email@example.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By default, acme.sh is installed in:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/.acme.sh/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Reload your shell environment:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Alternatively, reconnect to your SSH session.&lt;/p&gt;
&lt;h3 id="network-considerations-for-servers-in-mainland-china"&gt;Network Considerations for Servers in Mainland China
&lt;/h3&gt;&lt;p&gt;If your server is hosted in mainland China, downloading installation scripts directly from GitHub may result in connection timeouts or failures.&lt;/p&gt;
&lt;p&gt;There are several alternatives:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use a trusted domestic Git mirror.&lt;/li&gt;
&lt;li&gt;Download the source code on a machine with reliable GitHub access and upload it using SCP.&lt;/li&gt;
&lt;li&gt;Use a network environment that can access the official GitHub repository.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example, after downloading the source code:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone &lt;span class="o"&gt;[&lt;/span&gt;&amp;lt;trusted-mirror-url&amp;gt;&lt;span class="o"&gt;](&lt;/span&gt;https://gitee.com/neilpang/acme.sh.git&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; acme.sh
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./acme.sh --install -m your_email@example.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make sure the mirror is trustworthy and preferably synchronized with the official repository.&lt;/p&gt;
&lt;p&gt;For servers with limited GitHub connectivity, avoid enabling automatic upgrades without first verifying network access:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --upgrade --auto-upgrade
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Manual upgrades may be more reliable in restricted network environments.&lt;/p&gt;
&lt;h2 id="3-set-lets-encrypt-as-the-default-ca"&gt;3. Set Let&amp;rsquo;s Encrypt as the Default CA
&lt;/h2&gt;&lt;p&gt;After installation, configure Let&amp;rsquo;s Encrypt as the default certificate authority:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --set-default-ca --server letsencrypt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Future certificate requests will then use Let&amp;rsquo;s Encrypt by default.&lt;/p&gt;
&lt;h2 id="4-issuing-a-wildcard-certificate"&gt;4. Issuing a Wildcard Certificate
&lt;/h2&gt;&lt;p&gt;Wildcard certificates generally require DNS-01 validation.&lt;/p&gt;
&lt;p&gt;For example, we want a certificate covering:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;example.com
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;*.example.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;An important detail:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A certificate covering only &lt;code&gt;*.example.com&lt;/code&gt; does not automatically cover &lt;code&gt;example.com&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Therefore, it is recommended to include both the primary domain and the wildcard domain in the same certificate request.&lt;/p&gt;
&lt;p&gt;acme.sh supports two main approaches for DNS validation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Automatic DNS validation through provider APIs.&lt;/li&gt;
&lt;li&gt;Manual DNS validation by adding TXT records yourself.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&amp;rsquo;s look at the manual approach first.&lt;/p&gt;
&lt;h3 id="41-using-manual-dns-validation"&gt;4.1 Using Manual DNS Validation
&lt;/h3&gt;&lt;p&gt;If you do not want to store Alibaba Cloud AccessKey credentials on your server, you can use acme.sh&amp;rsquo;s manual DNS mode.&lt;/p&gt;
&lt;p&gt;Run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --issue --dns &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d example.com &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d &lt;span class="s1"&gt;&amp;#39;*.example.com&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --yes-I-know-dns-manual-mode-enough-go-ahead-please
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;acme.sh will generate the TXT records required for domain ownership verification.&lt;/p&gt;
&lt;p&gt;Example output:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Domain: &amp;#39;_acme-challenge.example.com&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TXT value: &amp;#39;xxxxxxxxxxxx&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Domain: &amp;#39;_acme-challenge.example.com&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;TXT value: &amp;#39;yyyyyyyyyyyy&amp;#39;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since both the primary domain and wildcard domain are included, you may need to add two TXT records.&lt;/p&gt;
&lt;h3 id="42-adding-txt-records-in-alibaba-cloud-dns"&gt;4.2 Adding TXT Records in Alibaba Cloud DNS
&lt;/h3&gt;&lt;p&gt;Log in to the Alibaba Cloud console:&lt;/p&gt;
&lt;p&gt;Cloud DNS → Select your domain → DNS Settings → Add Record.&lt;/p&gt;
&lt;p&gt;Configure the records using the values generated by acme.sh.&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Setting&lt;/th&gt;
					&lt;th&gt;Value&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;Record Type&lt;/td&gt;
					&lt;td&gt;TXT&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Host Record&lt;/td&gt;
					&lt;td&gt;_acme-challenge&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Record Value&lt;/td&gt;
					&lt;td&gt;TXT value generated by acme.sh&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;TTL&lt;/td&gt;
					&lt;td&gt;Default value&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If two TXT values are generated, add both records separately.&lt;/p&gt;
&lt;p&gt;Both records can use the same host record, but their values must remain different.&lt;/p&gt;
&lt;p&gt;Do not overwrite the first record when adding the second one.&lt;/p&gt;
&lt;h3 id="43-verifying-txt-records"&gt;4.3 Verifying TXT Records
&lt;/h3&gt;&lt;p&gt;Use dig to check whether the DNS records have propagated:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;dig TXT _acme-challenge.example.com +short
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make sure the returned values contain the verification strings generated by acme.sh.&lt;/p&gt;
&lt;h3 id="44-completing-certificate-issuance"&gt;4.4 Completing Certificate Issuance
&lt;/h3&gt;&lt;p&gt;After the TXT records become available, execute:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --renew -d example.com &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --yes-I-know-dns-manual-mode-enough-go-ahead-please
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once validation succeeds, the certificate will be issued.&lt;/p&gt;
&lt;p&gt;One important limitation:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Manual DNS mode does not support fully unattended automatic renewal.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Each renewal requires generating new verification values, manually updating the TXT records, and running the renewal command again.&lt;/p&gt;
&lt;p&gt;If you want unattended renewal, consider DNS API validation or DNS Alias mode instead.&lt;/p&gt;
&lt;h2 id="5-dns-alias-automatic-renewal-without-storing-main-domain-api-credentials"&gt;5. DNS Alias: Automatic Renewal Without Storing Main Domain API Credentials
&lt;/h2&gt;&lt;p&gt;If you do not want to store Alibaba Cloud API credentials on your server but also want to avoid manually updating TXT records, DNS Alias mode is worth considering.&lt;/p&gt;
&lt;p&gt;The idea is straightforward:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Keep your primary domain hosted on Alibaba Cloud.&lt;/li&gt;
&lt;li&gt;Prepare a separate auxiliary domain hosted by a DNS provider that supports API automation, such as Cloudflare.&lt;/li&gt;
&lt;li&gt;Create a CNAME record in Alibaba Cloud pointing the ACME challenge to the auxiliary domain.&lt;/li&gt;
&lt;li&gt;Use the auxiliary domain&amp;rsquo;s DNS API to manage TXT records automatically.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;_acme-challenge.example.com
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; CNAME
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;_acme-challenge.otherdomain.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then issue the certificate using:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --issue --dns dns_cf &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d example.com &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -d &lt;span class="s1"&gt;&amp;#39;*.example.com&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --challenge-alias otherdomain.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This approach avoids storing the primary domain&amp;rsquo;s Alibaba Cloud API credentials on the server.&lt;/p&gt;
&lt;p&gt;Make sure the auxiliary domain uses a DNS provider supported by acme.sh and that its API credentials are configured correctly.&lt;/p&gt;
&lt;h2 id="6-installing-certificates-for-nginx"&gt;6. Installing Certificates for Nginx
&lt;/h2&gt;&lt;p&gt;After issuing the certificate, you need to install it into a directory accessible to Nginx.&lt;/p&gt;
&lt;p&gt;The recommended approach is to use:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;--install-cert
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;instead of manually copying files with &lt;code&gt;cp&lt;/code&gt; or creating symbolic links with &lt;code&gt;ln -s&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The reason is that acme.sh remembers the destination paths and reload command.&lt;/p&gt;
&lt;p&gt;When a certificate is renewed, acme.sh can automatically copy the updated files to the target directory and reload Nginx.&lt;/p&gt;
&lt;h3 id="61-create-the-certificate-directory"&gt;6.1 Create the Certificate Directory
&lt;/h3&gt;&lt;p&gt;For example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /etc/nginx/ssl
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="62-install-the-certificate"&gt;6.2 Install the Certificate
&lt;/h3&gt;&lt;p&gt;You can also specify your own certificate filenames:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --install-cert -d example.com &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --key-file /etc/nginx/ssl/my_wildcard.key &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --fullchain-file /etc/nginx/ssl/my_wildcard.crt &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --reloadcmd &lt;span class="s2"&gt;&amp;#34;sudo systemctl reload nginx&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There are two important options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--key-file&lt;/code&gt;: Specifies the private key destination.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--fullchain-file&lt;/code&gt;: Specifies the full certificate chain destination.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Nginx should use the full certificate chain rather than only the server certificate.&lt;/p&gt;
&lt;p&gt;Certificate filenames are completely customizable. You can use &lt;code&gt;.crt&lt;/code&gt;, &lt;code&gt;.pem&lt;/code&gt;, or other extensions, as long as the paths match your Nginx configuration.&lt;/p&gt;
&lt;p&gt;Remember to create the destination directory before installing the certificate.&lt;/p&gt;
&lt;h2 id="7-configuring-nginx-for-wildcard-certificates"&gt;7. Configuring Nginx for Wildcard Certificates
&lt;/h2&gt;&lt;p&gt;After installing the certificate, configure your Nginx virtual host.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nginx" data-lang="nginx"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;example.com&lt;/span&gt; &lt;span class="s"&gt;*.example.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;301&lt;/span&gt; &lt;span class="s"&gt;https://&lt;/span&gt;&lt;span class="nv"&gt;$host$request_uri&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="s"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;http2&lt;/span&gt; &lt;span class="no"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;example.com&lt;/span&gt; &lt;span class="s"&gt;*.example.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;ssl_certificate&lt;/span&gt; &lt;span class="s"&gt;/etc/nginx/ssl/my_wildcard.crt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;ssl_certificate_key&lt;/span&gt; &lt;span class="s"&gt;/etc/nginx/ssl/my_wildcard.key&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;ssl_protocols&lt;/span&gt; &lt;span class="s"&gt;TLSv1.2&lt;/span&gt; &lt;span class="s"&gt;TLSv1.3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;ssl_session_cache&lt;/span&gt; &lt;span class="s"&gt;shared:SSL:10m&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;ssl_session_timeout&lt;/span&gt; &lt;span class="s"&gt;1d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;root&lt;/span&gt; &lt;span class="s"&gt;/var/www/html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="kn"&gt;index&lt;/span&gt; &lt;span class="s"&gt;index.html&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Notice that &lt;code&gt;server_name&lt;/code&gt; contains both:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nginx" data-lang="nginx"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;example.com&lt;/span&gt; &lt;span class="s"&gt;*.example.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The same certificate can therefore be used for the primary domain and matching first-level subdomains.&lt;/p&gt;
&lt;p&gt;However, wildcard certificates have an important limitation.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;*.example.com&lt;/code&gt; matches:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;www.example.com
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;api.example.com
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;admin.example.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It does not match multi-level subdomains such as:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;test.api.example.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="71-test-and-reload-nginx"&gt;7.1 Test and Reload Nginx
&lt;/h3&gt;&lt;p&gt;After modifying the configuration, validate the syntax:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo nginx -t
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the configuration is valid, reload Nginx:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl reload nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="8-verifying-wildcard-certificate-coverage"&gt;8. Verifying Wildcard Certificate Coverage
&lt;/h2&gt;&lt;p&gt;You can use OpenSSL to inspect the Subject Alternative Name (SAN) extension:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;openssl x509 &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -in /etc/nginx/ssl/my_wildcard.crt &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -noout &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -ext subjectAltName
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A successful wildcard certificate should produce output similar to:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;X509v3 Subject Alternative Name:
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; DNS:example.com, DNS:*.example.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This confirms that both the primary domain and wildcard domain are included.&lt;/p&gt;
&lt;h2 id="9-running-acmesh-as-a-non-root-user"&gt;9. Running acme.sh as a Non-Root User
&lt;/h2&gt;&lt;p&gt;Another practical issue occurs when acme.sh is installed under a regular Linux user account while Nginx certificate files are stored under:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/etc/nginx/ssl/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Even if the user has sudo privileges, acme.sh cannot automatically write to system directories or reload Nginx without the necessary permissions.&lt;/p&gt;
&lt;p&gt;There are two main issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The regular user cannot write to the certificate directory.&lt;/li&gt;
&lt;li&gt;Automatic renewal may fail when &lt;code&gt;systemctl reload nginx&lt;/code&gt; requires an interactive sudo password.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="91-granting-certificate-directory-access"&gt;9.1 Granting Certificate Directory Access
&lt;/h3&gt;&lt;p&gt;Assume the current Linux user is &lt;code&gt;ubuntu&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Create the directory:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo mkdir -p /etc/nginx/ssl
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;One simple approach is to assign ownership to the current user:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chown -R &lt;span class="nv"&gt;$USER&lt;/span&gt;:&lt;span class="nv"&gt;$USER&lt;/span&gt; /etc/nginx/ssl
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This allows acme.sh to write certificate files directly.&lt;/p&gt;
&lt;p&gt;If you prefer to preserve root ownership, consider using ACLs to grant write access to the specific user instead of changing the entire directory&amp;rsquo;s ownership.&lt;/p&gt;
&lt;p&gt;Changing the directory owner does not prevent Nginx from reading the certificates.&lt;/p&gt;
&lt;p&gt;Nginx normally uses a root-owned master process to load certificate files. Root retains the ability to read files regardless of their ownership.&lt;/p&gt;
&lt;p&gt;However, private key permissions should remain restrictive. Avoid making private keys readable by unnecessary users.&lt;/p&gt;
&lt;h3 id="92-allowing-passwordless-nginx-reload"&gt;9.2 Allowing Passwordless Nginx Reload
&lt;/h3&gt;&lt;p&gt;During automatic renewal, acme.sh needs to execute:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl reload nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Without a suitable sudoers rule, the scheduled renewal process may fail because it cannot enter a password interactively.&lt;/p&gt;
&lt;p&gt;First, find the actual systemctl path:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;which systemctl
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Assume the result is:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/usr/bin/systemctl
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create a dedicated sudoers configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$USER&lt;/span&gt;&lt;span class="s2"&gt; ALL=(ALL) NOPASSWD: /usr/bin/systemctl reload nginx&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; sudo tee /etc/sudoers.d/acme-nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Set the required permissions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo chmod &lt;span class="m"&gt;0440&lt;/span&gt; /etc/sudoers.d/acme-nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Test the configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo systemctl reload nginx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If the command succeeds without asking for a password, the configuration is working.&lt;/p&gt;
&lt;p&gt;This rule only allows the specified user to reload Nginx without a password. It does not grant passwordless access to every sudo command.&lt;/p&gt;
&lt;h3 id="93-installing-certificates-as-the-regular-user"&gt;9.3 Installing Certificates as the Regular User
&lt;/h3&gt;&lt;p&gt;Once the directory permissions and sudoers rule are configured, run the installation command directly as the regular user:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --install-cert -d example.com &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --key-file /etc/nginx/ssl/my_wildcard.key &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --fullchain-file /etc/nginx/ssl/my_wildcard.crt &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --reloadcmd &lt;span class="s2"&gt;&amp;#34;sudo systemctl reload nginx&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;One important warning:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Do not prepend &lt;code&gt;sudo&lt;/code&gt; to the acme.sh command.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Avoid:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo acme.sh --install-cert -d example.com
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Running acme.sh under sudo may cause it to use root&amp;rsquo;s environment and certificate directory:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/root/.acme.sh/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, the certificate you previously issued belongs to the regular user&amp;rsquo;s acme.sh installation.&lt;/p&gt;
&lt;p&gt;Keep certificate issuance, installation, and renewal under the same Linux user.&lt;/p&gt;
&lt;h2 id="10-useful-acmesh-maintenance-commands"&gt;10. Useful acme.sh Maintenance Commands
&lt;/h2&gt;&lt;p&gt;Here are some commands useful for daily certificate management.&lt;/p&gt;
&lt;p&gt;List issued certificates:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --list
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Force a renewal test:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --renew -d example.com --force
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Upgrade acme.sh:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --upgrade
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Enable automatic upgrades:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;acme.sh --upgrade --auto-upgrade
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The last option should only be enabled after verifying that the server can reliably access the upgrade source.&lt;/p&gt;
&lt;h2 id="11-conclusion"&gt;11. Conclusion
&lt;/h2&gt;&lt;p&gt;acme.sh provides a convenient way to automate SSL certificate issuance, deployment, and renewal.&lt;/p&gt;
&lt;p&gt;The DNS validation approaches covered in this article serve different needs:&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Method&lt;/th&gt;
					&lt;th&gt;Characteristics&lt;/th&gt;
					&lt;th&gt;Best For&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;DNS API&lt;/td&gt;
					&lt;td&gt;Automatically manages TXT records&lt;/td&gt;
					&lt;td&gt;Fully automated renewal&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;Manual DNS&lt;/td&gt;
					&lt;td&gt;Requires no API credentials&lt;/td&gt;
					&lt;td&gt;Users comfortable with manual renewal&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;DNS Alias&lt;/td&gt;
					&lt;td&gt;Keeps primary domain API credentials off the server&lt;/td&gt;
					&lt;td&gt;Automation with credential isolation&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;For most production environments, DNS API or DNS Alias is preferable because it reduces manual maintenance.&lt;/p&gt;
&lt;p&gt;However, successful certificate issuance is only part of the deployment process.&lt;/p&gt;
&lt;p&gt;You also need to configure the correct Nginx certificate paths, file permissions, and reload commands.&lt;/p&gt;
&lt;p&gt;When running acme.sh as a non-root user, handling directory permissions and passwordless Nginx reload in advance is particularly important.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The ultimate goal is not simply to obtain an SSL certificate, but to build a reliable certificate management workflow that can run continuously with minimal manual intervention.&lt;/strong&gt;&lt;/p&gt;</description></item></channel></rss>