概述
FastDFS配置https加密存取图片
将fastdfs改为https存取主要有几个步骤:
- 将/etc/fdfs/目录下的tracker.conf,storage.conf,client.conf 的http.server_port改为443
- 配置nginx 的SSL模块:https://www.cnblogs.com/ghjbk/p/6744131.html
- 配置SSL证书 :https://www.cnblogs.com/grimm/p/5938496.html
一.将/etc/fdfs/目录下的conf配置文件的http.server_port都改为443
1. cd /etc/fdfs/
#sudo vim tracker.conf
http.server_port=443
#sudo/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart 重启
#sudo vim storage.conf
http.server_port=443
#sudo /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart重启
#sudo vim client.conf
http.tracker_server_port=443
查看 Storage 是否成功启动,23000 端口正在被监听,就算 Storage 启动成功。
#sudo netstat -unltp|grep fdfs
tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 52750/fdfs_trackerd
tcp 0 0 0.0.0.0:23000 0.0.0.0:* LISTEN 53017/fdfs_storaged
查看Storage和Tracker是否在通信:
#/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
Storage 1:
id = 192.168.1.108
ip_addr = 192.168.1.108 ACTIVE
http domain =
version = 5.11
join time = 2018-11-13 12:07:21
up time = 2018-11-13 14:28:07
Storage 2:
id = 192.168.1.113
ip_addr = 192.168.1.113 ACTIVE
http domain =
version = 5.11
join time = 2018-11-14 14:14:13
up time = 2018-11-14 14:14:13
total storage = 19067 MB
free storage = 11907 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
二.配置nginx 的SSL模块
# cd nginx-1.13.12
#/usr/local/nginx/sbin/nginx –V 查看原有的模块
configure arguments: --add-module=../fastdfs-nginx-module-master/src
那么我们的新配置信息就应该这样写:
#./configure--add-module=../fastdfs-nginx-module-master/src --with-http_ssl_module
#make
然后备份原有已安装好的nginx
#cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
然后将刚刚编译好的nginx覆盖掉原有的nginx(这个时候nginx要停止状态)
停止nginx
#cd /usr/local/nginx/sbin/
#sudo ./nginx -s stop
# cd nginx-1.13.12
覆盖掉原有的nginx
# sudo cp ./objs/nginx /usr/local/nginx/sbin/
然后启动nginx,仍可以通过命令查看是否已经加入成功
# cd /usr/local/nginx/sbin/
#sudo ./nginx
仍可以通过命令查看是否已经加入成功
#/usr/local/nginx/sbin/nginx -V
二.配置SSL证书https://www.cnblogs.com/grimm/p/5938496.html
按照上面链接生成证书文件后配置nginx
# sudo vim /usr/local/nginx/conf/nginx.conf
配置:
# HTTPS server
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /usr/local/nginx/conf/33iq.crt;
ssl_certificate_key /usr/local/nginx/conf/33iq_nopass.key;
ssl on;
#ssl_session_cache shared:SSL:1m;
#ssl_session_timeout 5m;
#ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
location ~/group([0-9])/M00 {
ngx_fastdfs_module;
}
}
重启nginx
# cd /usr/local/nginx/sbin/
#sudo ./nginx -s reload
配置完成后可以测试使用https存取文件
Java fastdfs 工具类要该端口位443
fastdfs.http_tracker_http_port=433
最后
以上就是大力自行车为你收集整理的FastDFS配置https访问FastDFS配置https加密存取图片的全部内容,希望文章能够帮你解决FastDFS配置https访问FastDFS配置https加密存取图片所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复