Nginx(13)--https的实现

在安装编译nginx的时候编译模块--with-http_ssl_module
添加证书,使访问更加安全

实现方式

  • vim /usr/local/nginx/conf/nginx.conf #编辑nginx的配置文件
  • 编辑内容如下:
    Nginx(13)--https的实现
  • cd /etc/pki/tls/certs/ #切换到此目录下
  • make cert.pem #生成自签名证书
  • cp cert.pem /usr/local/nginx/conf/ #将生成的整数复制到配置目录下
    Nginx(13)--https的实现Nginx(13)--https的实现
  • mkdir web #建立location的目录
  • vim /web/index.html #编辑默认发布文件
  • nginx -t #查看编辑的配置文件是否有问题
  • nginx -s reload #重新加载服务

Nginx(13)--https的实现

测试

  • 在本机中要添加www.westos.org的解析

Nginx(13)--https的实现
Nginx(13)--https的实现Nginx(13)--https的实现Nginx(13)--https的实现