Skip to content

Instantly share code, notes, and snippets.

@iamshreeram
Created December 30, 2018 06:41
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save iamshreeram/a67abbbd23d56d058786c5530834086b to your computer and use it in GitHub Desktop.
Save iamshreeram/a67abbbd23d56d058786c5530834086b to your computer and use it in GitHub Desktop.
Installing SSL certificate in hostinger
# Installation of SSL Certificate
## Enable SSH :
ssh x123011738@31.170.164.22 -p 65002
## Download acme-client
git clone https://github.com/kelunik/acme-client
## Install composer
```
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');";
php composer-setup.php;
php -r "unlink('composer-setup.php');";
php composer.phar install --no-dev
```
## Generating SSL
php bin/acme setup --server letsencrypt --email admin@email.com
php bin/acme issue --domains yourdomain.com:www.youdomain.com --path /home/x123011738/public_html:/home/x123011738/public_html --server letsencrypt
Certificate : `/home/x123011738/acme-client/data/certs/acme-v01.api.letsencrypt.org.directory/yourdomain.com/fullchain.pem`
private key : `/home/x123011738/acme-client/data/certs/acme-v01.api.letsencrypt.org.directory/yourdomain.com/key.pem`
## [Add CRT and privatekey in hostinger]
## Checking expiration date and renewing SSL certificate
php acme-client/bin/acme check --name yourdomain.com --server letsencrypt
## Automatically renew Let’s Encrypt SSL certificate with cron job
php acme/acme-client/bin/acme issue --domains yourdomain.com:www.yourdomain.com --path /home/x123011738/public_html:/home/x123011738/public_html --server letsencrypt
@sahilr2050
Copy link

Hello Brother,

Can you please explain how I can use this script?

@rbtsolis
Copy link

Just copy and paste line by line, just replace x123011738 by your user in Hostinger

@DyegoPimentel
Copy link

Hi, the code in line 14 return a erro. say that composer.json is not installed. Do you know how it can fixed?

@brianizquierdo10
Copy link

this code is old. it hasn't been working

@iamshreeram
Copy link
Author

Installation Steps in here was created two years back. I have made this as a github repository . If any one is interested in fixing the commands, here is the issue . Feel free to fix and raise a PR. Thanks!

@nmatton
Copy link

nmatton commented May 24, 2022

this code works like a charm, just add the "--agree-terms" flag on line 18 and adapt the personal data on the following lines

note also that today, path to cert and pem are to acme-v02.api.letsencrypt.org.directory folder, according to the current acme version

@agadev
Copy link

agadev commented Jun 26, 2022

Working on 26 June 2022

Installation of SSL Certificate

Enable SSH :

ssh x123011738@31.170.164.22 -p 65002

Download acme-client

git clone https://github.com/kelunik/acme-client

Change directory to acme client

cd acme-client

Install composer inside acme-client directory, needs your php version to be 7.4

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"; 
php composer-setup.php;
php -r "unlink('composer-setup.php');";
php composer.phar install --no-dev

Generating SSL

php bin/acme setup --server letsencrypt --email admin@email.com --agree-terms

php bin/acme issue --domains yourdomain.com:www.youdomain.com --path /home/x123011738/public_html:/home/x123011738/public_html --server letsencrypt

Update 26/6/22 Certificates are stored in acme-v02.api instead of v01

Certificate : /home/x123011738/acme-client/data/certs/acme-v02.api.letsencrypt.org.directory/yourdomain.com/fullchain.pem
private key : /home/x123011738/acme-client/data/certs/acme-v02.api.letsencrypt.org.directory/yourdomain.com/key.pem

[Add CRT and privatekey in hostinger]

Checking expiration date and renewing SSL certificate

php acme-client/bin/acme check --name yourdomain.com --server letsencrypt

Automatically renew Let’s Encrypt SSL certificate with cron job

php acme/acme-client/bin/acme issue --domains yourdomain.com:www.yourdomain.com --path /home/x123011738/public_html:/home/x123011738/public_html --server letsencrypt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment