location

Nginx反向代理简单配置

匿名 (未验证) 提交于 2019-12-02 22:10:10
二、修改C:\windows\system32\drivers\etc\hosts文件,增加 127.0.0.1 test1.yubay.cn 、127.0.0.1 test2.yubay.cn 两个Ip 域名映射 三、修改Nginx配置文件nginx.conf,增加两个server节点 #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main;

nginx 跨域设置

匿名 (未验证) 提交于 2019-12-02 22:10:10
upstream nginx { ip_hash ; server 172.17 . 0.4 : 8081 weight = 2 ; server 172.17 . 0.5 : 8081 weight = 1 ; } server { listen 80 ; server_name www . enjoy . com ; if ( $http_origin ~ http : //(.*).enjoy.com){ set $allow_url $http_origin ; } #是否允许请求带有验证信息 add_header Access - Control - Allow - Credentials true ; #允许跨域访问的域名,可以是一个域的列表,也可以是通配符* add_header Access - Control - Allow - Origin $allow_url ; #允许脚本访问的返回头 add_header Access - Control - Allow - Headers 'x-requested-with,content-type,Cache-Control,Pragma,Date,x-timestamp' ; #允许使用的请求方法,以逗号隔开 add_header Access - Control - Allow - Methods 'POST

nginx.conf 代理转发

匿名 (未验证) 提交于 2019-12-02 22:10:10
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; #www.abc.com server { listen 80; server_name www.bac.com; #charset

nginx֮rewrite

匿名 (未验证) 提交于 2019-12-02 22:10:10
Ŀ¼ 1.URL访问跳转,支持开发设计页面跳转,兼容性支持,展示效果等 2.SEO优化 3.维护 4.安全 语法:rewrite regex replacement flag;,如: rewrite ^/images/(.*\.jpg)$ /imgs/$1 break; rewrite ^/bbs/(.*)$ http://www.idfsoft.com/index.html redirect; [root@khd~]#vim/usr/local/nginx/conf/nginx.conf location / { root html; index index.html index.htm; } location /status { stub_status on; allow all; } location /lcr{ root html; rewrite ^/lcr/(.*\.PNG)$ /ly/$1 break; 验证 location /lcr { root html; rewrite ^/lcr/(.*\.PNG)$ /ly/$1 break; } location /ly { root /var/www/html; } #error_page 404 /404.html; # redirect server error pages to the static page

nginx 之 proxy_pass详解

匿名 (未验证) 提交于 2019-12-02 22:10:10
在nginx中配置proxy_pass代理转发时,如果在proxy_pass后面的url加/,表示绝对根路径;如果没有/,表示相对路径,把匹配的路径部分也给代理走。 假设下面四种情况分别用 http://192.168.1.1/proxy/test.html 进行访问。 第一种: location /proxy/ { } 代理到URL:http://127.0.0.1/test.html 第二种(相对于第一种,最后少一个 / ) location /proxy/ { } 代理到URL:http://127.0.0.1/proxy/test.html 第三种: location /proxy/ { } 代理到URL:http://127.0.0.1/aaa/test.html 第四种(相对于第三种,最后少一个 / ) location /proxy/ { } 代理到URL:http://127.0.0.1/aaatest.html

nginx设置websocket

匿名 (未验证) 提交于 2019-12-02 22:10:10
一个简单的nginx配置 root@cc05314b19a3:/# cat /usr/local/tengine/conf/nginx.conf #user nobody; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on;

Nginx详解

匿名 (未验证) 提交于 2019-12-02 22:10:10
Nginx功能模块汇总 -- with - http_core_module    #包括一些核心的http参数配置,对应nginx的配置为http区块部分 -- with - http_access_module    #访问控制模块,用来控制网站用户对nginx的访问 -- with - http_gzip_module    #压缩模块,nginx返回的数据压缩,属于性能优化模块 -- with - http_fastcgi_module    #FastCGI模块,和动态应用相关的模块,例如PHP -- with - http_proxy_module    #proxy代理模块 -- with - http_upstream_module    #负载均衡模块,可以实现网站的负载均衡功能及节点的健康检查 -- with - http_rewrite_module    #URL地址重写模块 -- with - http_limit_conn_module    #限制用户并发连接及请求数模块 -- with - http_limit_req_module    #根据定义的key限制nginx请求过程的sulv -- with - http_log_module    #请求日志模块,以制定的个事记录nginx客户访问日志的信息 -- with - http_auth

(七十五)c#Winform自定义控件-控件水印组件

匿名 (未验证) 提交于 2019-12-02 22:09:29
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章。 GitHub: https://github.com/kwwwvagaa/NetWinformControl 码云: https://gitee.com/kwwwvagaa/net_winform_custom_control.git 如果觉得写的还行,请点个 star 支持一下吧 麻烦博客下方点个【推荐】,谢谢 NuGet Install-Package HZH_Controls Ŀ¼ https://www.cnblogs.com/bfyx/p/11364884.html 用处及效果 此效果只是牛刀小试,需要注意的是,像textbox这样的控件并不起作用,请注意。 你可以向目标控件绘图,画任何你想画的东西 准备工作 没什么可准备的 开始 添加一个类GraphicalOverlay ,继承Component 代码比较少,一次全上了,主要就是用控件的paint事件搞事情,逻辑比较简单 1 using System; 2 using System.ComponentModel; 3 using System.Drawing; 4 using System.Windows.Forms; 5 6 namespace HZH_Controls.Controls 7 { 8 [DefaultEvent(

[MySQL] mysql地理位置服务geometry字段类型

匿名 (未验证) 提交于 2019-12-02 22:06:11
这个字段类型是mysql5.7新增的功能,主要就是解决坐标存储和距离计算的常见问题 创建表: CREATE TABLE `service` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `name` varchar(128) NOT NULL DEFAULT '', `content` varchar(128) NOT NULL DEFAULT '', `tel` varchar(20) NOT NULL DEFAULT '', `location` geometry NOT NULL, PRIMARY KEY (`id`), KEY `location` (`location`(32)) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 插入坐标 insert into service (name,content,tel,location)values("陶士涵",'牛逼','18898989898',ST_GeomFromText('POINT(116.28828 40.053257)')); 读取坐标 select *,astext(location) from service; 查询距离 SELECT name,content,tel, (st_distance

Ubuntu:一个部署好的tomcat应用(war包)怎么用Nginx实现动静分离?

匿名 (未验证) 提交于 2019-12-02 21:56:30
今天想把之前的一个demo用Nginx把资源分离开来,在网上看了一天,整整弄了一天,硬是没弄出来。 要么全是同样的内容的,要么就是环境跟我这里不一样的。再加上对Nginx没接触过,给我都整哭了差点。 终于,到了下午有一点起色了,终于没有白费,还有最重要的一点事, 早看日志早完事了!!! 说明 这篇文章默认条件是你的nginx和tomcat都装好了,装好就可以,没配置可以看着文章一起配。 如果没有装的,可以参考下这里: nginx安装 , tomcat安装 我这里就不弄负载均衡了,因为我只是想把静态资源抽离出来交给nginx而已。 然后关于nginx的什么反向代理,负载均衡,什么什么架构这些,我就不解释了,还不知道的可以先去看一下。 当然我觉得你要是能看这篇文章,这些基本的知识都知道了。 这些都不重要,重要的是,怎么搭出来,怎么配置出来,所以我觉得 重中之重 的就是 nginx的配置 。 我遇到的问题是这样的,我一个挂在服务器上的demo,是ssm写的,其中用了tomcat的虚拟目录来装商品图片。 它里面还用到了一些别的静态资源如js、css、txt、jpg等等,总之就是静态资源,懂不懂哈哈哈。 我的demo是实打实的用网址加8080端口访问出来的, 所以就是说一个已经正常运行的项目需要在nginx的帮助下, 实现动静分离依然正常运行, 因为我看了一天的博文都是将如何从0开始搭的