资源描述 | 连接 |
---|---|
环境要求 | CentOS 7.x + |
FastDFS+Nginx部署 | https://github.com/happyfish100/fastdfs/wiki |
FastDFS集群部署 | https://github.com/happyfish100/fastdfs/wiki#%E5%88%86%E5%B8%83%E5%BC%8F%E9%83%A8%E7%BD%B2 |
FastDHT 分布式哈希系统搭建(文件去重) | https://github.com/happyfish100/fastdht/wiki |
Nginx配置详解 | https://www.runoob.com/w3cnote/nginx-setup-intro.html |
参考部署方案 | https://www.cnblogs.com/sanduzxcvbnm/p/12619900.html https://zhuanlan.zhihu.com/p/94976076 |
更多组件资源获取(缓存、代理、引擎、解析器等) | https://github.com/happyfish100?tab=repositories |
防盗链实现:
#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;
#keepalive_timeout 0;
keepalive_timeout 65;
upstream fdfs_group {
server localhost:8888;
}
server {
listen 80;
server_name localhost;
location ~/group([0-9])/M00 {
proxy_pass http://fdfs_group;
}
location / {
add_header Content-Type "text/html;charset=utf-8";
return 200 "非法访问";
#return 200 "非法访问:$request_uri";
}
}
#gzip on;
server {
listen 8888;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#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;
}
location ~ /group([0-9])/M00/([\w]+)/([\w]+)/([\w_-]+)\.(jpg|png|jpeg|gif|bmp|tif|java) {
# 防盗链,通过header referer来判断图片请求是不是从 本站发出的
valid_referers none blocked localhost *.baidu.com *.google.com;
ngx_fastdfs_module;
# 禁止外网的访问,只允许本地访问
allow 127.0.0.0/8;
deny all;
}
location / {
add_header Content-Type "text/html;charset=utf-8";
return 200 "非法访问.";
#return 200 "非法访问:$request_uri";
}
}
}