ubuntu apache 网站ssl 配置
Posted On 2022年5月22日
- 获取免费ssl证书:从阿里云可以获取,并下载。
- 编辑default-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/cert/7813799_yeshiwei.com_public.crt
SSLCertificateKeyFile /etc/apache2/cert/7813799_yeshiwei.com.key
SSLCertificateChainFile /etc/apache2/cert/7813799_yeshiwei.com_chain.crt
<FilesMatch “\.(cgi|shtml|phtml|php)$”>
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
</IfModule>
- 启用mod
sudo a2enmod ssl
systemctl restart apache2
sudo systemctl restart apache2
sudo a2enmod headers
sudo systemctl restart apache2
sudo a2enconf ssl-params
sudo systemctl restart apache2
sudo a2ensite default-ssl
sudo systemctl restart apache2
sudo apache2ctl configtest
sudo systemctl restart apache2