1.安装openssl
sudo apt-get install openssl
sudo apt-get install libssl-dev
2.将对应的认证文件domain.crt,domain.key放到/etc/nginx/ssl下
在site-avaliable的对应虚拟主机配置文件里加上以下内容
server {
listen 443;
server_name domain.com;
root /var/www/项目文件夹;
index index.php index.html index.htm;
ssl on;
ssl_certificate /etc/nginx/ssl/domain.crt;
ssl_certificate_key /etc/nginx/ssl/domain.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php last;
}
location / {
try_files $uri $uri/ /index.html;
}
}
3.重启ngnix