{"id":611,"date":"2022-10-24T11:45:22","date_gmt":"2022-10-24T18:45:22","guid":{"rendered":"https:\/\/blog.iabsolute.com\/?p=611"},"modified":"2022-10-24T11:47:51","modified_gmt":"2022-10-24T18:47:51","slug":"how-to-set-up-multiple-ssl-certificates-on-a-centos-vps-with-apache-using-one-ip-address","status":"publish","type":"post","link":"https:\/\/blog.iabsolute.com\/?p=611","title":{"rendered":"How To Set Up Multiple SSL Certificates On a CentOS VPS With Apache Using One IP Address"},"content":{"rendered":"\n<p>Make sure the mod_ssl security module is installed and enabled so the Apache web server can use the OpenSSL library and toolkit:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yum install mod_ssl openssl<\/pre>\n\n\n\n<p>Execute the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir -p \/etc\/httpd\/ssl\/\nmv \/etc\/httpd\/conf.d\/ssl.conf \/etc\/httpd\/conf.d\/ssl.conf.bak \ncd \/etc\/httpd\/ssl\/<\/pre>\n\n\n\n<p>Generate SSL certificate signing request (CSR) files for your domains:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">openssl genrsa -out domain1.key 2048\nopenssl req -new -key domain1.key -out domain1.csr\n\nopenssl genrsa -out domain2.key 2048\nopenssl req -new -key domain2.key -out domain2.csr<\/pre>\n\n\n\n<p>and enter the following details for your certificates:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Country Name<\/li><li>State or Province Name<\/li><li>Locality Name<\/li><li>Organization Name<\/li><li>Organizational Unit Name<\/li><li>Email Address<\/li><\/ul>\n\n\n\n<p>When prompted for the Common Name (i.e. domain name), enter the FQDN (fully qualified domain name) for the website you are securing.<\/p>\n\n\n\n<p>It is recommended to install commercial&nbsp;<a href=\"https:\/\/www.rosehosting.com\/ssl-certificates.html\" target=\"_blank\" rel=\"noreferrer noopener\">SSL certificates<\/a>&nbsp;when used in a production environment. Or, generate and use self-signed SSL certificates when you are just developing or testing a website or application using the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">openssl x509 -req -days 365 -in domain1.csr -signkey domain1.key -out domain1.crt\n\nopenssl x509 -req -days 365 -in domain2.csr -signkey domain2.key -out domain2.crt<\/pre>\n\n\n\n<p>Edit the \u2018ssl.conf\u2019 Apache configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vi \/etc\/httpd\/conf.d\/ssl.conf<\/pre>\n\n\n\n<p>and add the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">LoadModule ssl_module modules\/mod_ssl.so\n\nListen 443\n\nNameVirtualHost *:443\n\nSSLPassPhraseDialog&nbsp; builtin\nSSLSessionCacheTimeout&nbsp; 300\nSSLMutex default\nSSLRandomSeed startup file:\/dev\/urandom&nbsp; 256\nSSLRandomSeed connect builtin\nSSLCryptoDevice builtin\nSSLStrictSNIVHostCheck off\n\n&lt;VirtualHost *:443&gt;\nDocumentRoot \/var\/www\/html\/domain1\nServerName domain1.com\nServerAlias www.domain1.com\nSSLEngine on\nSSLProtocol all -SSLv2\nSSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW\nSSLCertificateFile \/etc\/httpd\/ssl\/domain1.crt\nSSLCertificateKeyFile \/etc\/httpd\/ssl\/domain1.key\n#SSLCertificateChainFile \/etc\/httpd\/ssl\/ca.crt\nErrorLog logs\/ssl_error_log\nTransferLog logs\/ssl_access_log\nLogLevel warn\n&lt;Files ~ \"\\.(cgi|shtml|phtml|php3?)$\"&gt;\n&nbsp;&nbsp;&nbsp; SSLOptions +StdEnvVars\n&lt;\/Files&gt;\nSetEnvIf User-Agent \".*MSIE.*\" \\\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nokeepalive ssl-unclean-shutdown \\\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; downgrade-1.0 force-response-1.0\nCustomLog logs\/ssl_request_log \\\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \\\"%r\\\" %b\"\n&lt;\/VirtualHost&gt;\n\n&lt;VirtualHost *:443&gt;\nDocumentRoot \/var\/www\/html\/domain2\nServerName domain2.com\nServerAlias www.domain2.com\nSSLEngine on\nSSLProtocol all -SSLv2\nSSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW\nSSLCertificateFile \/etc\/httpd\/ssl\/domain2.crt\nSSLCertificateKeyFile \/etc\/httpd\/ssl\/domain2.key\n#SSLCertificateChainFile \/etc\/httpd\/ssl\/ca.crt\nErrorLog logs\/ssl_error_log\nTransferLog logs\/ssl_access_log\nLogLevel warn\n&lt;Files ~ \"\\.(cgi|shtml|phtml|php3?)$\"&gt;\n&nbsp;&nbsp;&nbsp; SSLOptions +StdEnvVars\n&lt;\/Files&gt;\nSetEnvIf User-Agent \".*MSIE.*\" \\\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nokeepalive ssl-unclean-shutdown \\\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; downgrade-1.0 force-response-1.0\nCustomLog logs\/ssl_request_log \\\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \\\"%r\\\" %b\"\n&lt;\/VirtualHost&gt;\n<\/pre>\n\n\n\n<p>When using a commercial SSL certificate, it is likely the signing authority will include an intermediate CA certificate. In that case, create a new \u2018\/etc\/httpd\/ssl\/ca.crt\u2019 file and paste the contents of the Intermediate CA into it, then edit the the \u2018ssl.conf\u2019 configuration file and uncomment the following line:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SSLCertificateChainFile \/etc\/httpd\/ssl\/ca.crt<\/pre>\n\n\n\n<p>so the Apache web server can find your CA certificate.<\/p>\n\n\n\n<p>Test the Apache configuration:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/etc\/init.d\/httpd configtest\n\nSyntax OK<\/pre>\n\n\n\n<p>Restart the Apache service for the changes to take effect:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">service httpd restart<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Make sure the mod_ssl security module is installed and enabled so the Apache web server can use the OpenSSL library and toolkit: yum install mod_ssl openssl Execute the following commands: mkdir -p \/etc\/httpd\/ssl\/ mv \/etc\/httpd\/conf.d\/ssl.conf \/etc\/httpd\/conf.d\/ssl.conf.bak cd \/etc\/httpd\/ssl\/ Generate SSL &hellip; <a href=\"https:\/\/blog.iabsolute.com\/?p=611\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,36,21],"tags":[],"class_list":["post-611","post","type-post","status-publish","format-standard","hentry","category-centos","category-godday","category-ssl"],"_links":{"self":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=611"}],"version-history":[{"count":1,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/611\/revisions"}],"predecessor-version":[{"id":612,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/611\/revisions\/612"}],"wp:attachment":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}