Centos6.9编译安装nginx1.14.0
当前系统Centos6.9,Nginx版本1.14.0,关闭selinux,关闭防火墙(或自行设置) 1、配置好yum源,安装所需依赖
1 |
yum install wget gcc gcc-c++ pcre pcre-devel openssl openssl-devel zlib zlib-devel |
2、创建nginx启动用户 [crayon-6822b15 … 阅读全文
当前系统Centos6.9,Nginx版本1.14.0,关闭selinux,关闭防火墙(或自行设置) 1、配置好yum源,安装所需依赖
1 |
yum install wget gcc gcc-c++ pcre pcre-devel openssl openssl-devel zlib zlib-devel |
2、创建nginx启动用户 [crayon-6822b15 … 阅读全文
只允许百度谷歌等搜索引擎蜘蛛访问,正常用户无法访问,ua头根据自身情况进行增加删减 在nginx的server字段中配置下面内容即可
1 2 3 4 5 6 7 |
set $ua ''; if ($http_user_agent ~* (Baiduspider|googlebot|bing|sogou|yahoo)){ set $ua 1; } if ($ua != 1) { return 403; } |
附:Nginx屏蔽百度谷歌等搜索引擎蜘蛛方法https:// … 阅读全文
以下报错及解决办法在Centos6.9、Centos7.4系统,php5.6.35版本测试通过,其他系统及版本请自测 报错一: configure: error: no acceptable C compiler found in $PATH See `con … 阅读全文
当我们编译php的时候可能用到了很多的参数,但是时间一长,自己也不记得当时使用了哪些参数,此时可以通过下面这一行命令,就可以直接在服务器上看到,当前php编译时用到了哪些参数。
1 |
php -r "phpinfo();" | grep configure |
[crayon- … 阅读全文
root与alias主要区别在于nginx如何解释location后面的uri,这会使两者分别以不同的方式将请求映射到服务器文件上。 alias是一个目录别名的定义(仅能用于location上下文),root则是最上层目录的定义。 直接通过例子来理解: [cr … 阅读全文
原配置:
1 2 3 4 5 6 7 8 9 10 11 |
http { ...... limit_conn_zone $binary_remote_addr zone=one:10m; limit_req_zone $binary_remote_addr zone=fifa:10m rate=5r/s; ...... server { ...... limit_conn one 5; limit_req zone=fifa burst=100; ...... }} |
白名单配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
http { ...... geo $whiteiplist { default 1; 127.0.0.1 0; 10.10.0.0/24 0; } map $whiteiplist $limit { 1 $binary_remote_addr; 0 ""; } limit_conn_zone $limit zone=one:10m; limit_req_zone $limit zone=fifa:10m rate=5r/s; ...... server { ...... limit_conn one 5; limit_req zone=fifa burst=100; ...... }} |
说明: 1. geo指令定义一个白名单$whiteiplist, 默认值为1, 所有都受限制。 如果客户 … 阅读全文
ngx_lua_waf基于ngx_lua的web应用防火墙,使用起来简单,高性能和轻量级。 ♦防止sql注入,本地包含,部分溢出,fuzzing测试,xss,SSRF等web攻击 ♦防止svn/备份之类文件泄漏 ♦防止ApacheBench之类压力测试工具的攻 … 阅读全文
之前已经编译好了nginx,但是此时需要添加一个未被编译的模块,此处以--with-http_realip_module为例。 1、查看当前nginx编译安装时安装了哪些模块
1 |
nginx -V |
[crayon-6 … 阅读全文
当前实验环境默认存在3306端口的mysql并可以正常运行,在此基础上增加一个新的mysql实例并使用3307端口。 配置过程如下: 1、将默认的mysql配置文件复制一份
1 |
cp /etc/my.cnf /etc/my3307.cnf |
2、修改/etc/m … 阅读全文
当前使用centos7系统 1、安装nginx 参考https://blog.whsir.com/post-2078.html 2、docker拉取nginx镜像
1 |
docker pull nginx |
3、创建两个目录 [crayon … 阅读全文