{"id":3704,"date":"2014-06-11T14:45:51","date_gmt":"2014-06-11T19:45:51","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=3704"},"modified":"2022-12-15T03:11:13","modified_gmt":"2022-12-15T09:11:13","slug":"how-to-set-up-multiple-ssl-certificates-on-a-centos-vps-with-apache-using-one-ip-address","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multiple-ssl-certificates-on-a-centos-vps-with-apache-using-one-ip-address\/","title":{"rendered":"How To Set Up Multiple SSL Certificates On a CentOS VPS With Apache Using One IP Address"},"content":{"rendered":"
In this tutorial we will show you how to set up multiple SSL Certificates on a CentOS VPS<\/a> with Apache using one IP address only.<\/p>\n This is allowed by an extension to the SSL protocol called Server Name Indication (SNI). Most current desktop and mobile web browsers support SNI. The main benefit of using SNI is the ability to secure multiple websites without purchasing more IP addresses.<\/p>\n <\/p>\n 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 Execute the following commands:<\/p>\n Generate SSL certificate signing request (CSR) files for your domains:<\/p>\n and enter the following details for your certificates:<\/p>\n 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 It is recommended to install commercial SSL certificates<\/a> 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 Edit the ‘ssl.conf’ Apache configuration file:<\/p>\n and add the following lines:<\/p>\n When using a commercial SSL certificate, it is likely the signing authority will include an intermediate CA certificate. In that case, create a new ‘\/etc\/httpd\/ssl\/ca.crt’ file and paste the contents of the Intermediate CA into it, then edit the the ‘ssl.conf’ configuration file and uncomment the following line:<\/p>\n so the Apache web server can find your CA certificate.<\/p>\n Test the Apache configuration:<\/p>\n Restart the Apache service for the changes to take effect:<\/p>\n Open https:\/\/domain1.com and https:\/\/domain2.com in your favorite web browser and verify that SSL certificates are installed correctly.<\/p>\n Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to set up multiple SSL Certificates on your VPS for you. They are available 24×7 and will take care of your request immediately.<\/p>\n PS<\/span>.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" In this tutorial we will show you how to set up multiple SSL Certificates on a CentOS VPS with Apache … <\/p>\nyum install mod_ssl openssl<\/pre>\n
mkdir -p \/etc\/httpd\/ssl\/\r\nmv \/etc\/httpd\/conf.d\/ssl.conf \/etc\/httpd\/conf.d\/ssl.conf.bak \r\ncd \/etc\/httpd\/ssl\/<\/pre>\n
openssl genrsa -out domain1.key 2048\r\nopenssl req -new -key domain1.key -out domain1.csr\r\n\r\nopenssl genrsa -out domain2.key 2048\r\nopenssl req -new -key domain2.key -out domain2.csr<\/pre>\n
\n
openssl x509 -req -days 365 -in domain1.csr -signkey domain1.key -out domain1.crt\r\n\r\nopenssl x509 -req -days 365 -in domain2.csr -signkey domain2.key -out domain2.crt<\/pre>\n
vi \/etc\/httpd\/conf.d\/ssl.conf<\/pre>\n
LoadModule ssl_module modules\/mod_ssl.so\r\n\r\nListen 443\r\n\r\nNameVirtualHost *:443\r\n\r\nSSLPassPhraseDialog\u00a0 builtin\r\nSSLSessionCacheTimeout\u00a0 300\r\nSSLMutex default\r\nSSLRandomSeed startup file:\/dev\/urandom\u00a0 256\r\nSSLRandomSeed connect builtin\r\nSSLCryptoDevice builtin\r\nSSLStrictSNIVHostCheck off\r\n\r\n<VirtualHost *:443>\r\nDocumentRoot \/var\/www\/html\/domain1\r\nServerName domain1.com\r\nServerAlias www.domain1.com\r\nSSLEngine on\r\nSSLProtocol all -SSLv2\r\nSSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW\r\nSSLCertificateFile \/etc\/httpd\/ssl\/domain1.crt\r\nSSLCertificateKeyFile \/etc\/httpd\/ssl\/domain1.key\r\n#SSLCertificateChainFile \/etc\/httpd\/ssl\/ca.crt\r\nErrorLog logs\/ssl_error_log\r\nTransferLog logs\/ssl_access_log\r\nLogLevel warn\r\n<Files ~ \"\\.(cgi|shtml|phtml|php3?)$\">\r\n\u00a0\u00a0\u00a0 SSLOptions +StdEnvVars\r\n<\/Files>\r\nSetEnvIf User-Agent \".*MSIE.*\" \\\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 nokeepalive ssl-unclean-shutdown \\\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 downgrade-1.0 force-response-1.0\r\nCustomLog logs\/ssl_request_log \\\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \\\"%r\\\" %b\"\r\n<\/VirtualHost>\r\n\r\n<VirtualHost *:443>\r\nDocumentRoot \/var\/www\/html\/domain2\r\nServerName domain2.com\r\nServerAlias www.domain2.com\r\nSSLEngine on\r\nSSLProtocol all -SSLv2\r\nSSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW\r\nSSLCertificateFile \/etc\/httpd\/ssl\/domain2.crt\r\nSSLCertificateKeyFile \/etc\/httpd\/ssl\/domain2.key\r\n#SSLCertificateChainFile \/etc\/httpd\/ssl\/ca.crt\r\nErrorLog logs\/ssl_error_log\r\nTransferLog logs\/ssl_access_log\r\nLogLevel warn\r\n<Files ~ \"\\.(cgi|shtml|phtml|php3?)$\">\r\n\u00a0\u00a0\u00a0 SSLOptions +StdEnvVars\r\n<\/Files>\r\nSetEnvIf User-Agent \".*MSIE.*\" \\\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 nokeepalive ssl-unclean-shutdown \\\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 downgrade-1.0 force-response-1.0\r\nCustomLog logs\/ssl_request_log \\\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \\\"%r\\\" %b\"\r\n<\/VirtualHost>\r\n<\/pre>\n
SSLCertificateChainFile \/etc\/httpd\/ssl\/ca.crt<\/pre>\n
\/etc\/init.d\/httpd configtest\r\n\r\nSyntax OK<\/pre>\n
service httpd restart<\/pre>\n