-
更改Nginx head
-
更改Nginx error page
-
关闭域名@解析
-
启用CDN解析
-
更改Wordpress文章作者
-
使用普通权限启动nginx
-
nginx目录权限设置
-
不记录历史命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#说明:以下代码中//---//分隔符用于标识vim 编辑器内容 vim src/core/nginx.h //-------------------------------- #define nginx_version 3520000 #define NGINX_VERSION "3.5.20" #define NGINX_VER "squid/" NGINX_VERSION --------------------------------// vim src/http/ngx_http_header_filter_module.c //-------------------------------- static u_char ngx_http_server_string[] = "Server: squid" CRLF; --------------------------------// vim nginx/conf/nginx.conf //-------------------------------- server_tokens off; --------------------------------// |
验证:curl -I www.desenpast.com
1 2 3 4 5 6 |
#说明:以下代码中//---//分隔符用于标识vim 编辑器内容 vim src/http/ngx_http_special_response.c //-------------------------------- static u_char ngx_http_error_tail[] = "<hr>squid" CRLF --------------------------------// |
说明:个人域名一般可以关闭,但不建议企业域名关闭@解析;
用途:与CDN配合使用,隐藏主站点IP地址、减少主站点被恶意攻击的风险;
云解析 DNS:删除或暂停主机记录为“@”且记录值为主机IP地址的DNS解析记录;
验证:ping desenpast.com(找不到主机)。
用途:隐藏主站点IP地址、减少主站点被恶意攻击的风险,也可用于加速站点访问;
云解析 DNS:添加CNAME记录类型,主机记录为www,记录值为CDN供应商的DNS域名(如:http-desenpast.b0.aicdn.com);
验证:通过“IPIP.NET | 卡卡网 | 站长工具”来测试 www.desenpast.com 所解析到的IP地址。
用途:建立专用的用户发布文章,管理员用户发布文章可能被用于暴力破解;
修改文章作者:
mysql> use wordpress;
mysql> select post_title,post_author from wp_posts where post_title='Elize - Shake';
mysql> update wp_posts set post_author=1 where post_title='Elize - Shake';
用途:避免nginx版本漏洞提权;
允许nginx监听80端口:
setcap cap_net_bind_service=+ep /usr/local/nginx/sbin/nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#说明:以下代码中//---//分隔符用于标识vim 编辑器内容 vim /etc/init.d/nginx //-------------------------------- start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 make_dirs echo -n $"Starting $prog: " sudo -u nginx $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && sudo -u nginx touch $lockfile return $retval } --------------------------------// |
用途:防止nginx用户修改原程序内容;
前提:需要更改nginx日志文件路径,html站点存放目录需要设置php用户为所有者;
权限设置:
chmod -R o-rwx /usr/local/nginx
chmod -R g-w /usr/local/nginx
chown -R 0:nginx /usr/local/nginx
chown -R php:nginx /usr/local/nginx/html/*
rm ~/.bash_history && ln -s /dev/null ~/.bash_history
rm ~/.mysql_history && ln -s /dev/null ~/.mysql_history