[code:1:d7afe9cd8c]openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mysitename.key -out mysitename.crt[/code:1:d7afe9cd8c]
[code:1:d7afe9cd8c]You will be prompted to enter your organizational information and a common name. The common name should be the fully qualified domain name for the site you are securing (www.mydomain.com). You can leave the email address, challenge password, and optional company name blank. When the command is finished running, it will create two files: a mysitename.key file and a mysitename.crt self signed certificate file valid for 365 days.
Install Your Self Signed Certificate
Now, you just need to configure your Apache virtual host to use the SSL certificate. If you only have one Apache virtual host to secure and you have an ssl.conf file being loaded, you can just edit that file. Otherwise, you will need to make a copy of the existing non-secure virtual host, paste it below, and change the port from port 80 to 443.
Open your Apache configuration file in a text editor. Depending on your operating system and Apache version, it will be located in different places but you will usually find it at /etc/httpd/httpd.conf. On a Windows machine, you will usually find it at C:Program FilesApacheApache2confhttpd.conf
In most cases, you will find the <VirtualHost> blocks in a separate file in a directory like /etc/httpd/vhosts.d/ or /etc/httpd/sites/. Add the lines in bold below. <VirtualHost>
# SSLCertificateChainFile /etc/ssl/crt/intermediate.crt
Change the names of the files and paths to match your certificate files. Save the changes and exit the text editor.
Restart your Apache web server using one of the following commands: /usr/local/apache/bin/apachectl startssl
do not forget this
[code:1:d7afe9cd8c]sudo a2enmod ssl[/code:1:d7afe9cd8c]
Leave a Reply