Fastdfs
手动搭建,需要ifconfig,手动设置TRACKER_IP为外网ip
docker run -d --name=tracker -v /home/fastdfs/tracker:/data/fast_data --privileged=true --net=host morunchang/fastdfs sh tracker.sh
docker run -d --name=storage -v /home/fastdfs/storage:/data/fast_data --privileged=true --net=host -e TRACKER_IP=192.168.99.240:22122 -e GROUP_NAME=group1 morunchang/fastdfs sh storage.sh
百度服务器安装命令:
mkdir -p /home/fastdfs/tracker
mkdir -p /home/fastdfs/storage
docker run -d --name=tracker -v /home/fastdfs/tracker:/data/fast_data --privileged=true --net=host --restart=always morunchang/fastdfs sh tracker.sh /home/fastdfs/tracker
docker run -d --name=storage -v /home/fastdfs/storage:/data/fast_data --privileged=true --net=host --restart=always -e TRACKER_IP=39.96.78.70:22122 -e GROUP_NAME=group1 morunchang/fastdfs sh storage.sh
#防火墙放行
firewall-cmd --zone=public --add-port=22122/tcp --permanent
firewall-cmd --reload
自带nginx的docker:
docker network create fastdfs-net
docker run -dit --network=fastdfs-net --name tracker -v /var/fdfs/tracker:/var/fdfs ygqygq2/fastdfs-nginx:latest tracker
docker run -dit --network=fastdfs-net --name storage0 -e TRACKER_SERVER=192.168.99.240:22122 -v /var/fdfs/storage0:/var/fdfs ygqygq2/fastdfs-nginx:latest storage
配置docker:
docker安装见:
https://shimo.im/docs/CTWWYr9TwqXHqYKy
nginx配置文件:
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 443 ssl;
#填写绑定证书的域名
server_name file.qbserver.cn;
#证书文件名称
ssl_certificate 1_file.qbserver.cn_bundle.crt;
#私钥文件名称
ssl_certificate_key 2_file.qbserver.cn.key;
ssl_session_timeout 5m;
#请按照以下协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
charset utf-8;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
add_header Access-Control-Allow-Methods GET,POST;
location /group1/M00 {
alias /home/fastdfs/storage/data;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
server {
listen 80;
#填写绑定证书的域名
server_name file.qbserver.cn;
#把http的域名请求转成https
return 301 https://$host$request_uri;
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# 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;
# }
#}
}