How To Create a Self-Signed SSL Certificate for Apache on CentOS 8

published 30.06.2020 16:37

Make sure to include the trailing *:80 ServerName your_domain_or_ip Redirect / and close this file when you are finished, then test your configuration syntax again, and reload Apache: sudo apachectl configtest sudo systemctl reload httpd You can test the new redirect functionality by visiting your site with plain http:// in front of the address.

Open the same Apache configuration file we started in previous steps: sudo vi the bottom, create another VirtualHost block to match requests on port 80.

The remaining lines specify a DocumentRoot directory to serve files from, and the SSL options needed to point Apache to our newly-created certificate and key.

Step 3 — Configuring Apache to Use SSL Now that we have our self-signed certificate and key available, we need to update our Apache configuration to use them.

We can create the SSL key and certificate files with the openssl command: sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout -out you enter the command, you will be taken to a prompt where you can enter information about your website.

by Brian Boucheron from

Free awesomeness straight to your inbox!

Sign up now for this free newsletter to receive hand picked content, covering topics like Lifestyle, Business & Technology.

Free Newsletter Sign up now!

..or jump directly to the latest posts!