Server: Didi Cloud ECS
Environment: lamp (Ubuntu + Apache + mysql +php7)
Apply to the service provider where the domain name was originally located
Just choose the free type.
After the application is approved, download the certificate.
Unzip four folders and a csr file.
The four folders (Apache, IIS, Nginx, Tomcat) are respectively the SSL certificates used by different server frameworks.
sudo apt-get install openssl
enter
sudo a2enmod ssl
If invalid, enter the following two commands
sudo ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/ssl.load
sudo ln -s /etc/apache2/mods-available/ssl.conf /etc/apache2/mods-enabled/ssl.conf
mkdir /etc/apache2/cert
Enter /etc/apache2/ports.conf, check if there is
Listen 80
Listen 443
Add it if not
sudo vim /etc/apache2/sites-enabled/000-default.conf
Add to
< VirtualHost *:443>
SSLEngine on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM
SSLHonorCipherOrder on
SSLCertificateFile cert/xxx_public.crt
SSLCertificateKeyFile cert/xxx.key
SSLCertificateChainFile cert/xxx_chain.crt
ServerAdmin webmaster@localhost
DocumentRoot project address
ServerName www.xxx.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>
Open /etc/apache2/sites-available/000-default.conf,
Add the following three lines anywhere in the <\VirtualHost *:80><\VirtualHost> tag
RewriteEngine on
RewriteCond %{HTTPS}!=on
RewriteRule ^(.*) https://%{SERVER_NAME}$1[L,R=301]
sudo service apache2 restart
HelpYourSelf!(https://www.cnblogs.com/yangfei123/p/10131961.html)
soha_dong(https://blog.csdn.net/soha_dong/article/details/92424562)
All rights reserved: 可定博客© WNAG.COM.CN
Title of this article: "Ubuntu Apache configuration https certificate"
Link to this article: https://wnag.com.cn/155.html
Special statement: Unless otherwise noted, all articles on this site are original. In principle, reprinting of articles on this site is prohibited. If you really want to reprint, please contact: [email protected], respect the achievements of others' labor, thank you~
Recommended Posts