Apache服务器的防盗链技术

服务器 专栏收录该内容
¥59.90 ¥99.00
117篇文章

防盗链是一种常见的服务器安全措施,用于限制其他网站或未经授权的用户直接链接服务器上的资源。通过配置Apache服务器,可以实现防盗链功能,确保只有经过授权的请求可以访问受保护的资源。本文将介绍如何使用Apache服务器的模块和配置来实现防盗链功能。

  1. 开启 mod_rewrite 模块
    首先,确保服务器上已经启用了 mod_rewrite 模块。mod_rewrite 是Apache服务器的一个核心模块,用于重写URL和执行基于规则的重定向。

在终端中执行以下命令,启用 mod_rewrite 模块:

sudo a2enmod rewrite
sudo systemctl restart apache2
  1. 创建.htaccess 文件
    .htaccess 文件是Apache服务器中用于配置特定目录的文件。我们将在需要进行防盗链的目录下创建一个名为 .htaccess 的文件。如果该目录下已经存在 .htaccess 文件,则直接编辑即可。

在 .htaccess 文件中添加以下代码:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]

代码解析:

  • RewriteEngine On
Apache配置与应用-防盗链及隐藏版本信息 文章目录一、概览1、配置Apache实现防盗链2、配置规则变量说明3、配置Apache实现防盗链4、配置Apache隐藏版本信息二、实验步骤1、实验准备2、安装应用(主机1)3、编辑配置文件(主机1)4、编辑配置文件(主机1)5、编辑配置文件(主机1)6、启动服务(主机1)7、复制文件到linux上面(主机1)8、文件解压(主机1)9、文件夹移动(主机1)10、安装工具软件(主机1)11、配置修改(主机1)12、编译并安装(主机1)13、创建软链接(主机1)14、打开站点文件并上传图片(主机1)15、编辑网 阅读详情

相关推荐

Apache 防盗链的技术小结

一. 遭遇图片盗链   个人网站使用的是国外付费空间,有流量限制。今天是 2007.03.29,收到主机商的通知邮件,提醒我本月的流量即将超出配额。——超出流量,就要向万恶的美帝资本家交银子,吓我一跳,平常网站的流量根本使用不完,马上查看 awstats 的日志分析,没有发现什么异常。于是把 access log 日志拉下来,用逆火网站日志分析器检查了一下站点盗链情况,发现本站的 深圳高交会之神州龙芯 CPU 映象记[图文] 以及 香港2005年春季行(3) – 庙街风光等原创文章中的图片,被许多网站直接盗链,造成流量占用大幅上升。   国内网站盗链成风,最倒霉的就是咱们这种使用付费主机有流量

LabVIEW机器视觉通用软件

LabVIEW 通用视觉一款仿C模式的思想与方法 全网最精简零基础+通用视觉全套视频教程 只想把LabVIEW当作一种兴趣,结果却当成了职业 http://t.elecfans.com/c1181.html 本次(开源 )针对有一定视觉基础或项目开发经验的工程师量身打造视觉通用性系统(完全仿面向对象的原理),相对于一般的非标框架更具功能性,有效的解决复杂项目开发过程中的思路瓶颈。 LabVIEW通用视觉系统:通用软件可快速解决大部分简单的视觉开发项目,帮助众多软件工程师解决在非标视觉软件开发中的繁琐过程问

qq_21516871的博客 4616

UIPath 获取网页元素做遍历点击的实现

UIPath 获取网页元素做遍历点击的实现

geekqian的博客 1万+

【QMIX】一种基于Value-Based多智能体算法

文章目录1. QMIX 解决了什么问题(Motivation)2. QMIX 怎样解决团队收益最大化问题(Method)2.1 算法大框架 —— 基于 AC 框架的 CTDE(Centralized Training Distributed Execution) 模式 QMIX 是一种基于 Value-Based 的多智能体强化学习算法(MARL),其基本思想来源于 Actor-Critic 与 DQN 的结合。使用中心式学习(Centralized Learning)分布式执行(Distributed

qq_38638132的博客 9865

【C++实战(62)】从0到1:C++打造TCP网络通信实战指南

本文是 C++ 网络编程实战专栏第 62 篇,聚焦 TCP 客户端与服务端开发。先阐述 TCP 协议特点、核心 API 及阻塞与非阻塞 IO 区别,打牢基础;再详解 TCP 服务端初始化、客户端连接处理与数据收发,以及客户端初始化、异常处理和协议设计;最后通过简易聊天系统实战,介绍线程池应用、协议解析及稳定性测试,助力开发者掌握 TCP 网络编程实操技能。

邓邓子的博客 1004

openharmony之UniProton内核技术揭秘:鸿蒙面向工业控制领域的RTOS设计之道

UniProton是鸿蒙操作系统面向工业控制领域的轻量级实时操作系统(RTOS),专为资源受限的嵌入式设备设计。作为鸿蒙生态的重要组成部分,UniProton提供了高效的实时任务调度、内存管理和IPC机制,满足工业控制场景对实时性和可靠性的严格要求。想象一下,UniProton就像一个超级聪明的管家,管理着电子设备里所有的工作。让你的智能手表既能显示时间,又能接收消息让家里的扫地机器人既能避开障碍物,又能记住哪里已经打扫过了让工厂里的机器人手臂既能精确地抓取东西,又能快速地完成任务实时性强。

m0_67505153的博客 888

让 ABAP 开发者也能做出高质量 SAP Fiori:到底需要掌握多少前端知识?

文章摘要: 随着SAP技术演进,ABAP开发者的角色边界正在重构。传统SAP GUI时代的全栈开发模式逐渐转向RAP+Fiori Elements的新范式,其中关键技术变化包括: 开发模式转变:从前后端耦合转向RAP模型驱动开发,通过CDS注解实现UI意图表达 分工优化:Fiori Elements模板处理80%标准UI需求,Flexible Programming Model解决20%差异化需求 效率提升:注解驱动开发可在RAP建模阶段同步定义UI结构,大幅缩短交付周期 工具整合:SAP提供从建模到部署的

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 357

深入剖析 Wenet 下 AISHELL-1 的 run.sh 脚本:从数据准备到模型训练

run.sh脚本用于处理 AISHELL-1 数据集的整个训练和测试流程。我们将逐步分析脚本中的每个部分,包括环境变量、参数设置、各个阶段的执行等。stage: 设置脚本的起始阶段(如数据准备)。stop_stage: 设置脚本的结束阶段。通过对 Wenet 下 AISHELL-1 的run.sh脚本的详细剖析,我们希望你能更好地理解每个步骤的功能及其背后的原理。此脚本不仅为模型训练提供了便利,也为用户自定义和扩展训练流程提供了基础。希望本教程能帮助你顺利完成语音识别项目!

帅小柏的博客 1636

使用 MATLAB/Simulink 对基于同步发电机的双机系统进行建模

双机系统(Two-Machine System)是电力系统中用于研究动态稳定性和控制策略的一个典型模型。它由两台同步发电机通过输电网络相互连接,模拟实际电网中的互联操作。当发生短路故障时,系统的暂态稳定性会受到挑战,可能导致发电机失步或电压崩溃。本教程将带你使用 MATLAB/Simulink 对基于同步发电机的双机系统进行建模,并对其在短路故障条件下的暂态稳定性进行仿真和分析。

amy_mhd的博客 224

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 通过Windows作为代理服务器连接Linux服务器
下一篇: CentOS 安装 Bugzilla 服务器详解
普通网友
博客等级 码龄3年 40粉丝 7原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址