Last active
September 18, 2019 09:13
-
-
Save mrtuvn/db0db00dcd6d8df5e558c9ffe19ad2f5 to your computer and use it in GitHub Desktop.
My snippets contains commands need for create self-signed cert in apache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
https://github.com/magento-research/venia-pwa-concept/pull/13 (Optional) | |
sudo apt-get update | |
sudo apt-get install openssl libnss3-tools (optional install libnss3) | |
sudo a2enmod ssl | |
sudo mkdir -p /etc/ssl/private/ | |
sudo openssl genrsa -des3 -out /etc/ssl/private/magento2.test.key 4096 | |
# User input | |
sudo openssl req -new -key /etc/ssl/private/magento2.test.key -out /etc/ssl/private/magento2.test.csr | |
# User input | |
sudo openssl x509 -req -days 365 -in /etc/ssl/private/magento2.test.csr -signkey /etc/ssl/private/magento2.test.key -out /etc/ssl/private/magento2.test.crt | |
Make sure you add CN cert info as domain name | |
Country Name (2 letter code) [AU]:US | |
State or Province Name (full name) [Some-State]:New York | |
Locality Name (eg, city) []:New York City | |
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Bouncy Castles, Inc. | |
Organizational Unit Name (eg, section) []:Ministry of Water Slides | |
Common Name (e.g. server FQDN or YOUR name) []:server_IP_address | |
Email Address []:admin@your_domain.com | |
# User input | |
sudo openssl rsa -in /etc/ssl/private/magento2.test.key -out /etc/ssl/private/magento2.test.key.insecure | |
# User input | |
sudo mv /etc/ssl/private/magento2.test.key /etc/ssl/private/magento2.test.key.secure | |
sudo mv /etc/ssl/private/magento2.test.key.insecure /etc/ssl/private/magento2.test.key | |
sudo service apache2 restart | |
cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/default-ssl.conf.bak | |
<IfModule mod_ssl.c> | |
<VirtualHost *:443> | |
ServerName magento2.test | |
DocumentRoot /var/www/html | |
SSLEngine on | |
SSLCertificateFile /etc/ssl/private/magento2.test.crt | |
SSLCertificateKeyFile /etc/ssl/private/magento2.test.key | |
<Directory /var/www/html> | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
Require all granted | |
</Directory> | |
</VirtualHost> | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment