Skip to content

Instantly share code, notes, and snippets.

@otnansirk
Created February 3, 2021 16:06
Show Gist options
  • Save otnansirk/7f1db39e3514d77c80fe31f8e9d4ea27 to your computer and use it in GitHub Desktop.
Save otnansirk/7f1db39e3514d77c80fe31f8e9d4ea27 to your computer and use it in GitHub Desktop.
Install Certutil
$ apt install libnss3-tools -y
Install mkcert
$ wget https://github.com/FiloSottile/mkcert/releases/download/v1.1.2/mkcert-v1.1.2-linux-amd64
$ mv mkcert-v1.1.2-linux-amd64 mkcert
$ chmod +x mkcert
$ cp mkcert /usr/local/bin/
Generate local CA
$ mkcert -install
You will see Created a new local CA at "/home/amos/.local/share/mkcert" ?
Find CA path by typing
$ mkcert -CAROOT
/home/amos/.local/share/mkcert
Generate Local SSL Certificates
➜ ~ sudo mkcert maubelajar.local '*.maubelajar.local' localhost 127.0.0.1 ::1 //this command
Using the local CA at "/home/kris/.local/share/mkcert" ✨
Created a new certificate valid for the following names 📜
- "maubelajar.local"
- "*.maubelajar.local"
- "localhost"
- "127.0.0.1"
- "::1"
The certificate is at "./maubelajar.local+4.pem" and the key at "./maubelajar.local+4-key.pem" ✅
➜ ~ ls
Enable CA to webserver.
in this case use LAMP.
/opt/lampp/etc/extra
➜ extra cat httpd-vhosts.conf
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:443>
ServerName maubelajar.local
ServerAlias www.maubelajar.local
ServerAdmin kris@maubelajar.local
# DocumentRoot /opt/lampp/htdocs/maubelajar
DocumentRoot /home/kris/K15/Project/maubelajarapa
SSLEngine on
# SSLCertificateFile "/opt/lampp/etc/ssl.crt/server.crt"
# SSLCertificateKeyFile "/opt/lampp/etc/ssl.key/server.key"
SSLCertificateFile "/opt/lampp/certificate/maubelajar.local+4.pem"
SSLCertificateKeyFile "/opt/lampp/certificate/maubelajar.local+4-key.pem"
<Directory /home/kris/K15/Project/maubelajarapa>
AllowOverride All
</Directory>
# <Directory /var/www/andi.io/public_html>
# Options -Indexes +FollowSymLinks
# AllowOverride All
# </Directory>
# ErrorLog /var/log/httpd/andi.io-error.log
# CustomLog /var/log/httpd/andi.io-access.log combined
</VirtualHost>
Restart webserver
- Enjoy it :*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment