转自How To Secure Apache with Let's Encrypt on Ubuntu 14.04
文中的步骤有三步,安装成功其实只需两步即可
此处尝试翻译,也可以直接阅读原文。
安装都完成后,在这个地址查询是否成功(记得更改example.com为自己的域名)。
https://www.ssllabs.com/ssltest/analyze.html?d=example.com&latest
若为成功,就可以访问"https://example.com"(你自己的网址啦)
这时候会出现Apache2的default page,有“It works!”字样的页面。接下来在/etc/apache2/sites-available/default-ssl.conf作些许修改
将
DocumentRoot /var/www/html
修改
DocumentRoot /var/www/your_project/
( 改到自己项目的入口文件所在目录下即可 )
下来重启服务器/etc/init.d/apache2 restart
然后在自己的域名前加https,回车,就可以访问了
出现问题:
1.异步请求http接口失败
Mixed Content: The page at 'https://domain/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://domain/api'. This request has been blocked; the content must be served over HTTPS.
XMLHttpRequest cannot load http://domain/api . Failed to start loading.
2.访问域名下的其他路由会报错
![](https://img.haomeiwen.com/i3241894/154e4340b767f987.png)
网友评论