首页 > Web > 列表

nginx使用


反向代理

location /mySystem/ {
    #设置被代理服务器的端口或套接字,以及URL
    proxy_pass  http://192.168.1.56:8081;
    proxy_redirect off;

    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-Forwarded-Proto https;
    #以上三行,目的是将代理服务器收到的用户的信息传到真实服务器上
    proxy_set_header REMOTE-HOST $remote_addr;

    client_max_body_size 50m;
    client_body_buffer_size 256k;
    proxy_connect_timeout 15s;#nginx与upstream server的连接超时时间
    proxy_send_timeout 30s;#nginx发送数据至upstream server超时, 默认60s, 如果连续的60s内没有发送1个字节, 连接关闭
    proxy_read_timeout 60s;#nginx接收upstream server数据超时, 默认60s, 如果连续的60s内没有收到1个字节, 连接关闭
	#以下这些参数都是针对每一个http request ,不是全局的。
    proxy_buffer_size 256k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
    proxy_temp_file_write_size 256k;
    proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
    proxy_max_temp_file_size 128m;
}  

阅读全文 »


支付宝当面付JSAPI


调用统一收单创建接口,整体流程是在支付宝打开调用页面后点击下单,商户后台调用统一收单创建接口,调用成功返回结果给下单页面,下单页面根据tradeNo的值执行jJSAPI吊起支付宝钱包然后付款,付款成功后商户后台的异步通知地址收到支付结果通知

支付文档

快速接入

  1. 在支付宝开放平台创建了应用APP
  2. 配置商户公钥,商户私钥自己保存
  3. 确定签名方式,建议RSA2
  4. 配置授权域名,只有授权的域名才能拿到auth_code
  5. 配置支付宝网关
  6. 签约当面付

阅读全文 »


HTTP请求封装


引入依赖

<dependency>
	<groupId>org.apache.httpcomponents</groupId>
	<artifactId>httpcore-nio</artifactId>
</dependency>
<dependency>
	<groupId>org.apache.httpcomponents</groupId>
	<artifactId>httpasyncclient</artifactId>
</dependency>

阅读全文 »


dubbo注册zookeeper问题


provider配置文件

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
	http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

阅读全文 »


JS获取时间并格式化


获取当天的零点

var todayStart = new Date(new Date().toLocaleDateString());

获取当天的结束时间

var oneday = 1000 * 60 * 60 * 24;
var todayEnd = new Date(todayStart.getTime() + oneday - 1);

获取本月的第一天的零点

var monthStart = new Date((new Date(new Date().setDate(1)).toLocaleDateString()));

阅读全文 »


natapp内网穿透


注册

登录https://natapp.cn/register注册natapp账号
登录后可购买免费隧道,配置本地端口

阅读全文 »


IDEA中个别依赖下载失败


项目导入时总有那么几个jar下载失败,但同样的maven,在另外一台电脑使用IDEA是能正常下载的。

使用原始setting.xml下载失败,尝试了使用阿里云镜像,还是不可以

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>       
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror> 

阅读全文 »


ajax登录


jsp:

    <label>用户名</label><input id="username" name="username" value="${u.username}">
	<label>密码</label><input id="password" name="password" value="${u.password}">
	<span id="error"></span>
	<br><br><br><br><br>
	<input type="button" value="登录" onclick="return loginyz(this)"/> 

阅读全文 »


后端返回json


使用Ajax访问后台

$("#ddd").click(function(){
	$.ajax({
		type:'post',
		url:"<%=basePath%>messageServlet?method=jsonTest",
		data:{id:2},
		success:function(data){
			alert(data);					
		},
		error : function() {
	  // view("异常!");
	  alert("异常!");
	 }
	});
});  

阅读全文 »


jQuery动态添加栏位


table表

<table class="common">
      <tr>
    		<td>
    			工号
    		</td>
    		<td>
    			 <input type="text" id="number" name="number" />
    		</td>
    		<td>
	    		 <button  onclick="add($(this));">add</button>&nbsp;|&nbsp;  
		       <button onclick="delete($(this));">delete</button>
    		</td>
	</tr>
	</table>

阅读全文 »


使用filter校验登录


请求先经过过滤器,如果已经登录了,就执行该请求,否则先进入登录界面。

阅读全文 »


tomcat部署web项目


方法1

将项目war包(可在eclipse中将项目export war包)直接拷贝到tomcat目录下的webapps文件下,运行tomcat,它会自行解压,通过项目名直接访问即可

阅读全文 »


前端定义json


WEB-INF文件夹下新建json文件夹,新建一个test.json文件

testJson={
	"testA":{
		"a1" : "20", 
		"a2" : "30", 
	},
	"testB":{
		"b1" : "20", 
		"b2" : "30", 
	},
} 

阅读全文 »


IMG自适应DIV


1、div设置width:100%

2、img设置

img{
	max-width:100%;
	max-height:100%;
}

阅读全文 »


java文件上传


jsp:

<form action="fileupload" method="post" enctype="multipart/form-data" name="form1">  
  	  <input type="file" name="file">  
	    <input type="file" name="file">
   	   <input type="file" name="file">
   	   <input type="submit" name="Submit" value="upload">  
</form>    

阅读全文 »