directadmin manual ssl using cmd

 To generate an SSL certificate for a domain using letsencrypt.sh (now commonly known as acme.sh) in DirectAdmin, follow these steps:


/usr/local/directadmin/data/users/ajayuser/domains



step-by-Step Guide:

Access the Server via SSH:



ssh root@your_server_ip

Install acme.sh:

Install acme.sh if it is not already installed. You can install it using the following command:



curl https://get.acme.sh | sh

Issue an SSL Certificate for Your Domain:

You need to set up the necessary environment variables for DirectAdmin and then issue the certificate. Here's how:


a. Export Environment Variables:



export DP_Id="your_directadmin_username"

export DP_Key="your_directadmin_api_key"


b. Generate the Certificate:

Use acme.sh to generate the certificate for your domain. Replace yourdomain.com with your actual domain and www.yourdomain.com with any subdomain if needed:



Issue the Certificate Using DNS Method:


/root/.acme.sh/acme.sh --issue --dns dns_dp -d ajayferocast.com -d www.ajayferocast.com




/root/.acme.sh/acme.sh --register-account -m support@drushti.in




[root@linux2 mnt]# /root/.acme.sh/acme.sh --register-account -m support@drushti.in

[Wed Jul 24 21:24:57 IST 2024] No EAB credentials found for ZeroSSL, let's obtain them

[Wed Jul 24 21:24:58 IST 2024] Registering account: https://acme.zerossl.com/v2/DV90


[Wed Jul 24 21:24:59 IST 2024] Registered

[Wed Jul 24 21:24:59 IST 2024] ACCOUNT_THUMBPRINT='KZA3KZHlt4NviPtmFHxcM-RyWc8UQMUItqyEPiBVonw'



/usr/local/directadmin/data/users/admin



vi user.conf


login_keys=ON


http://192.227.108.55:2222/CMD_LOGIN_KEYS?redirect=yes



export DP_Id="admin"

export DP_Key="bumkailashkumar"



Issue the Certificate Using Webroot Method:


/root/.acme.sh/acme.sh --issue --webroot -d /home/ajayuser/public_html/ ajayferocast.com -d www.ajayferocast.com




Install the Certificate in DirectAdmin:

After the certificate is issued, install it in DirectAdmin.



/root/.acme.sh/acme.sh --install-cert -d ajayferocast.com \

--cert-file /usr/local/directadmin/data/users/ajayuser/domains/ajayferocast.com.cert \

--key-file /usr/local/directadmin/data/users/ajayuser/domains/ajayferocast.com.key \

--ca-file /usr/local/directadmin/data/users/ajayuser/domains/ajayferocast.com.cacert \

--fullchain-file /usr/local/directadmin/data/users/ajayuser/domains/ajayferocast.com.fullchain \

--reloadcmd "service directadmin restart"

Replace ajayuser with the DirectAdmin username associated with the domain.


Configure DirectAdmin to Use the Certificate:

Edit the SSL configuration file for your domain to use the generated certificate files.



nano /usr/local/directadmin/data/users/ajayuser/domains/ajayferocast.com.ssl

Ensure the file contains the correct paths:



SSLCertificateFile=/usr/local/directadmin/data/users/ajayuser/domains/ajayferocast.com.cert

SSLCertificateKeyFile=/usr/local/directadmin/data/users/ajayuser/domains/ajayferocast.com.key

SSLCACertificateFile=/usr/local/directadmin/data/users/ajayuser/domains/ajayferocast.com.cacert

Restart DirectAdmin and Web Server:

Restart DirectAdmin and the web server to apply the changes.



service directadmin restart

service httpd restart  # for Apache web server

# or

service nginx restart  # for Nginx web server

Automated Renewal

To ensure the certificates are renewed automatically, you can set up a cron job.



/root/.acme.sh/acme.sh --install-cronjob

This will install the cron job for automatic renewal.


By following these steps, you can issue and install an SSL certificate for your domain using the webroot method with acme.sh in DirectAdmin.








Comments

Popular posts from this blog

cpanel exam CPSP Answers

How to install zimbra collaboration suite 8.8.11 on CentOS 7

awstats installation