使得项目可以通过https连接访问,ssl(Secure Sockets Layer)
配置步骤如下:
rails项目中设置ssl
#config/environments/production.rb
config.force_ssl = true
使用let's encrypt来获取免费的ssl
#安装let's encrypt客户端
ssh deploy@IPADDRESS
cd ~ #切换用户目录
git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt #切换letsencrypt目录
./letsencrypt-auto #进行安装,按照步骤来就可以
#生成dhparams.pem
cd ~
openssl dhparam -out dhparams.pem 2048
#系统会自动将各类参数添加到example.com.conf文件中
sudo service nginx reload
sudo service nginx restart
#ubuntu16.04问题解决
#OSError: Command /opt/eff.org/certbot/venv/bin/python2.7 - setuptools pkg_resources pip wheel failed with error code 1
apt-get install letsencrypt
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"