标签:inf ror word www tps static write 处理 localhost
配置nginx实现防盗链[root@localhost ~]# cd /usr/local/nginx/
[root@localhost nginx]# ls
client_body_temp fastcgi_temp logs sbin uwsgi_temp
conf html proxy_temp scgi_temp
[root@localhost nginx]# cd html/
[root@localhost html]# ls
50x.html index.html qq.jpg
[root@localhost html]# mount.cifs //192.168.254.10/linuxs /abc
Password for root@//192.168.254.10/linuxs:
[root@localhost html]# cd /abc
[root@localhost abc]# ls
error.png
[root@localhost abc]# cp error.png /usr/local/nginx/html/
[root@localhost abc]# cd -
/usr/local/nginx/html
[root@localhost html]# ls
50x.html error.png index.html qq.jpg
[root@localhost html]# grep "qq.jpg" index.html
<img src="qq.jpg">
[root@localhost html]# service nginx start
[root@localhost html]# netstat -natp | grep 80
tcp 0 0 192.168.247.193:80 0.0.0.0:* LISTEN 3038/nginx: master
使用域名,需要使用dns解析服务
搭建dns详见我前面的博客
然后指定盗链主机和客户机的dns服务器
开始设置盗机
在win10内打开控制面板,控制面板内打开程序和功能,里面有开启或者关闭功能,点击
然后点击internet informatoion servers
关闭盗机防火墙
然后客户端去访问盗机网站
盗链成功,接下来做防盗链操作:
[root@localhost html]# vim /usr/local/nginx/conf/nginx.conf
location ~*\.(jpg|gif|swf)$ {
valid_referers none blocked *.shl.com shl.com;
if ( $invalid_referer ) {
rewrite ^/ http://www.shl.com/error.png;
}
}
重启nginx服务
[root@localhost named]# service nginx stop
[root@localhost named]# service nginx start
防盗链配置成功
FPM优化参数调整示例
[root@localhost ~]# vim /usr/local/php/etc/php-fpm.conf
pid = run/php-fpm.pid
pm = dynamic
pm.max_children=20
pm.static_servers = 5
pm.min_spare_servers = 2
pm.max_spare_servers = 8
标签:inf ror word www tps static write 处理 localhost
原文地址:https://blog.51cto.com/14557905/2463657