> 文章列表 > https访问fastdfs图片

https访问fastdfs图片

https访问fastdfs图片

引用:https://blog.csdn.net/love8753/article/details/128872320
配置nginx 的SSL模块:https://www.cnblogs.com/ghjbk/p/6744131.html

  1. 获取ssl证书

    将ssl证书,拷贝到服务器的一个目录下

  2. nginx添加 http_ssl_module
    最开始安装的nginx只有 fastdfs-nginx-module 模块,,如果需要使用https访问必须指定启用 http_ssl_module 模块,该模块提供了 SSL/TLS 功能,使得nignx可以通过 https协议提供加密传输服务

wget http://nginx.org/download/nginx-1.15.4.tar.gz #下载nginx压缩包
tar -zxvf nginx-1.15.4.tar.gz #解压
cd nginx-1.15.4/#  添加fastdfs-nginx-module  和http_ssl_module 
./configure --prefix=/usr/local/nginx --add-module=/usr/local/src/fastdfs-nginx-module/src/ --with-http_ssl_module# 编译安装
make
make install
  1. 修改fastdfs配置文件,配置https

    /etc/fdfs 目录下的 tracker.conf , storage.conf , client.conf 的 http.server_port 改为 443

    vim /etc/fdfs/tracker.conf 
    # 在tracker.conf中添加
    enable_ssl = true
    
    # 在storage.conf中添加
    ssl_cert_file = /usr/local/nginx/ssl/lsdfjhs.com_bundle.crt
    ssl_key_file = /usr/local/nginx/ssl/lsdfjhs.com.key
    

修改完成之后,重启fastdfs的storage和tracker

# 重启tracker
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
# 重启 storage
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
# 查看状态
netstat -unltp|grep fdfs/usr/bin/fdfs_monitor /etc/fdfs/storage.conf 

https访问fastdfs图片

  1. 修改nginx配置文件
    修改server
   server {# listen  8888;  listen       443 ssl;    ## 该端口为storage.conf中的http.server_port相同server_name  localhost;# 证书ssl_certificate /usr/local/nginx/ssl/lsdfjhs.com_bundle.crt;# 私钥ssl_certificate_key  /usr/local/nginx/ssl/lsdfjhs.com.key;location ~/group[0-9]/ {ngx_fastdfs_module;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}

检查配置文件是否有错:

# 检查配置文件是否有错:
./nginx -t
# 重启nginx
/usr/local/nginx/sbin/nginx -s reload

遇到的问题:
重新编译安装nginx的时候,之前的nginx没有关闭