摘要: 现在浏览器或者系统访问网页都会有自己的一套缓存机制,这就可能会导致前端代码已经更新了,但是用户还是访问了之前的缓存。 这里介绍下用nginx处理这个问题的方法,这里配置html和htm文件不缓存 server { listen 80; server_name test.exmaple.cn; loc 阅读全文
posted @ 2021-01-20 11:00 随便写写-运维 阅读(12596) 评论(0) 推荐(0)
摘要: nginx配置允许跨域 add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; add_header Access-Control-Allow-He 阅读全文
posted @ 2020-12-24 18:32 随便写写-运维 阅读(6375) 评论(1) 推荐(1)
摘要: 例如, 应用场景:如果源IP不是1.1.1.1和2.2.2.2这两个IP的地址,访问就return 403 思路:把多个不同的 子条件,定义为同一个父条件。然后if判断这个父条件,来进行操作。 set $my_ip ''; if ( "$remote_addr" = "1.1.1.1" ){set 阅读全文
posted @ 2020-08-05 10:22 随便写写-运维 阅读(3905) 评论(0) 推荐(0)
摘要: 修改tomcat配置文件server.xml 这里以jenkins为例子: <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="jenkins" 阅读全文
posted @ 2020-08-03 15:51 随便写写-运维 阅读(3427) 评论(0) 推荐(0)
摘要: 关闭tomcat的一些不安全http请求方法: 在tomcat的web.xml或者项目的web.xml中添加以下参数:(图中tomcat版本为7.0.61) <security-constraint> <web-resource-collection> <web-resource-name>fort 阅读全文
posted @ 2020-08-03 15:46 随便写写-运维 阅读(1719) 评论(0) 推荐(0)
摘要: 使用nginx做负载均衡的时候,查看某一个请求被转发到哪一个后端服务器上 在server{}中加入下面两行:(这里的$upstream_status 和 $upstream_addr是日志格式里面有的,这个要配合自己定义的日志来使用) add_header backendCode $upstream 阅读全文
posted @ 2020-07-02 10:35 随便写写-运维 阅读(5500) 评论(0) 推荐(0)
摘要: listen 443 ssl; # listen 443; (这里使用443 ssl这种方式,ssl on的方式可能会https访问400 bad request) # ssl on;ssl_certificate pem;ssl_certificate_key key;ssl_session_ti 阅读全文
posted @ 2020-06-23 12:29 随便写写-运维 阅读(4373) 评论(0) 推荐(0)
摘要: 80强制用户跳转443 server { listen 80; server_name xxx.com; return 301 https://$server_name$request_uri; #server_name有多个,$server_name可换成$host } 下面加你的https配置s 阅读全文
posted @ 2020-06-23 12:27 随便写写-运维 阅读(992) 评论(0) 推荐(0)
摘要: nginx指定文件路径有两种方式root和alias,指令的使用方法和作用域: [root]语法:root path默认值:root html配置段:http、server、location、if[alias]语法:alias path配置段:location root与alias主要区别在于ngi 阅读全文
posted @ 2020-06-23 12:18 随便写写-运维 阅读(800) 评论(0) 推荐(0)
摘要: cat access.log |awk '{print $1}' |sort |uniq -c |sort -nk1 -r sort -n 以数值排序;uniq -c 去重+统计次数 阅读全文
posted @ 2020-06-23 12:11 随便写写-运维 阅读(1085) 评论(0) 推荐(0)