防盗链
在企业网站服务中,一般都要配置防盗链功能,以避免网站内容被非法盗用,造成经济损失,也避免了不必要的带宽浪费。
Nginx 的防盗链功能也非常强大,在默认情况下,只需要进行很简单的配置,即可实现防盗链处理
配置盗链网站主机
yum install -y httpd #安装httpd服务
cd /var/www/html #切换至站点目录
vim index.html
在盗链网站主机添加域名域名映射关系
在Web源主机添加域名映射关系
在盗链网站开启服务,并在网页中测试
[root@localhost html]# systemctl restart httpd
配置防盗链
编辑主配置文件
[root@localhost html]# vim /usr/local//nginx/conf//nginx.conf
[root@localhost html]# nginx -t #检查配置文件语法
将盗链图片拉入web网站根目录
[root@localhost html]# systemctl restart nginx.service