首页
关于
统计
归档
更多
留言
壁纸
导航
Search
1
JS常用正则表达式大全
235 阅读
2
Js自动播放HTML音乐(不受浏览器限制,无需先与浏览器交互,无需对浏览器进行修改)
177 阅读
3
利用JS给页面添加FPS帧数显示
171 阅读
4
利用PHP压缩CSS、JS 输出
150 阅读
5
JavaScript实现电脑手机端网页跳转
148 阅读
默认分类
学习笔记
PHP
Linux
Typecho
WordPress
Javascript
Mysql
Nginx
Apache
随笔杂谈
登录
/
注册
Search
标签搜索
javascript
正则表达式
Mysql
Nginx
Typecho
累计撰写
14
篇文章
累计收到
2
条评论
今日撰写
0
篇文章
首页
栏目
默认分类
学习笔记
PHP
Linux
Typecho
WordPress
Javascript
Mysql
Nginx
Apache
随笔杂谈
页面
关于
统计
归档
留言
壁纸
导航
用户登录
登录
注册
搜索到
14
篇与
学习笔记
的结果
2022-10-29
Nginx反向代理配置去除前缀
前言使用nginx做反向代理的时候,可以简单的直接把请求原封不动的转发给下一个服务。设置proxy_pass请求只会替换域名,如果要根据不同的url后缀来访问不同的服务,则需要通过如下方法:方法一:加"/""server { listen 8000; server_name demo.gmit.vip; access_log "pipe:rollback /home/log/nginx/access.log interval=1d baknum=7 maxsize=1G" main; location ^~/user/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://user/; } location ^~/order/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_pass http://order/; } }{callout color="#f0ad4e"}^~/user/表示匹配前缀是user的请求,proxy_pass的结尾有/, 则会把/user/*后面的路径直接拼接到后面,即移除user{/callout}方法二:rewriteupstream user { server localhost:8089 weight=5; } upstream order { server localhost:8090 weight=5; } server { listen 80; server_name www.gmit.vip; access_log "pipe:rollback /home/log/nginx/access.log interval=1d baknum=7 maxsize=1G" main; location ^~/user/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; rewrite ^/user/(.*)$ /$1 break; proxy_pass http://user; } location ^~/order/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; rewrite ^/order/(.*)$ /$1 break; proxy_pass http://order; } }{callout color="#f0ad4e"}proxy_pass结尾没有/, rewrite重写了url{/callout}
2022年10月29日
115 阅读
0 评论
0 点赞
2022-10-29
利用JS给页面添加FPS帧数显示
页面FPS帧数显示这里记录一下代码left:3 左边距离3top:3 上边距离3自己可以改方向$('body').before('<div id="fps" style="z-index:10000;position:fixed;top:3;left:3;font-weight:bold;"></div>'); var showFPS = (function(){ var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000/60); }; var e,pe,pid,fps,last,offset,step,appendFps; fps = 0; last = Date.now(); step = function(){ offset = Date.now() - last; fps += 1; if( offset >= 1000 ){ last += offset; appendFps(fps); fps = 0; } requestAnimationFrame( step ); }; appendFps = function(fps){ console.log(fps+'FPS'); $('#fps').html(fps+'FPS'); }; step(); })();
2022年10月29日
171 阅读
0 评论
0 点赞
2022-10-29
Apache与Nginx网站跨域设置
前言网站一般在需要共享资源给其他网站时(跨域传递数据),才会设置access-control-allow-origin HTTP头设置Access-Control-Allow-Origin,可以解决多域名跨域问题Access-Control-Allow-Origin * 等所有网站都可以跨域访问Access-Control-Allow-Origin gqink.cn 允许gqink.cn跨域访问Apache<IfModule mod_headers.c> Header set Access-Control-Allow-Origin: "*" Header set Access-Control-Allow-Methods: "GET,POST,PUT,DELETE,OPTIONS" Header set Access-Control-Allow-Headers: "Content-Type" </IfModule>{callout color="#f0ad4e"}添加到httpd.conf最下面{/callout}Nginxadd_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'PUT,POST,GET,DELETE,OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Content-Type,Content-Length, Authorization, Accept,X-Requested-With';或者 location / { add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept"; add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; } Html<meta http-equiv="Access-Control-Allow-Origin" content="*" />Javaresponse.setHeader("Access-Control-Allow-Origin", "*"); .netResponse.AddHeader("Access-Control-Allow-Origin", "*");
2022年10月29日
90 阅读
0 评论
0 点赞
2022-10-29
利用JavaScript加载css、js文件
//加载css文件函数 function link(url) { var link = document.createElement("link"); link.rel = "stylesheet"; link.type = "text/css"; link.href = url; document.getElementsByTagName("head")[0].appendChild(link); } //加载css文件函数 //加载js文件函数 function script(url) { var newscript = document.createElement('script'); newscript.setAttribute('type','text/javascript'); newscript.setAttribute('src',url); var head = document.getElementsByTagName('head')[0]; head.appendChild(newscript); } //加载js文件函数 script("js文件链接"); //执行加载js文件 link("css文件的链接"); //执行加载css文件
2022年10月29日
127 阅读
0 评论
0 点赞
2022-10-29
Mysql数据库删除重复记录只保留一条
查出重复的typeSELECT type FROM table GROUP BY type HAVING count(type) > 1;查出重复type数据中最小的idSELECT min(id) FROM table GROUP BY type HAVING count(type) > 1;查出重复的type数据中非最小的id(要删的数据)SELECT id FROM table WHERE type in( SELECT type FROM table GROUP BY type HAVING count(type) > 1) AND id not IN(SELECT min(id) FROM table GROUP BY type HAVING count(type) > 1);在Mysql中是不能删除查询出来的记录,而是要通过一张临时表来解决SELECT id from ( SELECT id FROM table WHERE type in( SELECT type FROM table GROUP BY type HAVING count(type) > 1) AND id not IN(SELECT min(id) FROM table GROUP BY type HAVING count(type) > 1) ) as t;删除type重复的数据(只保留一条,保留最小id的)DELETE FROM table WHERE id IN ( SELECT id from ( SELECT id FROM table WHERE type in( SELECT type FROM table GROUP BY type HAVING count(type) > 1) AND id not IN(SELECT min(id) FROM table GROUP BY type HAVING count(type) > 1) ) as t );
2022年10月29日
66 阅读
0 评论
0 点赞
1
2
3