ubuntu 16.04 Apache 下配置ssl
1.下载好CA证书。阿里云、腾讯云均有免费证书提供
2.加载OpenSSL模块
3.开启Apache的ssl模块
a2enmod ssl
4.上传证书,修改配置文件,如图(默认路径:/etc/apache2/sites-available/default-ssl.conf )
5.建立软连接
sudo ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/001-ssl.conf
6.重启Apache
/etc/init.d/apache2 restart
注:
thinkphp下修改.htaccess文件将http重定向到https
Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{HTTPS} !=on RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]