重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

便利贴

2018-4-2822:27 匹配EXCEL字符串

创新互联服务项目包括洪泽网站建设、洪泽网站制作、洪泽网页制作以及洪泽网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,洪泽网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到洪泽省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

=IF(AND((ISNUMBER(VALUE(RIGHT(LEFT(A2,2),2)))),(RIGHT(LEFT(A2,3),1)="/"),(ISNUMBER(VALUE(MID(A2,4,2)))),(RIGHT(LEFT(A2,6),1)="/"),(ISNUMBER(VALUE(MID(A2,7,4)))),(RIGHT(LEFT(A2,11),1)=""),(ISNUMBER(VALUE(MID(A2,12,2)))),(RIGHT(LEFT(A2,14),1)=":"),(ISNUMBER(VALUE(MID(A2,15,2)))),(RIGHT(LEFT(A2,17),1)=":"),(ISNUMBER(VALUE(MID(A2,18,2)))),(VALUE(RIGHT(LEFT(A2,2),2))<24),(VALUE(MID(A2,4,2))<31),(VALUE(MID(A2,7,4))<=YEAR(TODAY())),(VALUE(MID(A2,12,2))<24),(VALUE(MID(A2,15,2))<60),(VALUE(MID(A2,18,2))<60),(LEN(A2)=19)),"TRUE","FALSE")

nginx安装与调优 启动容器 liwangdeMacBook-Air:~liwang$dockerrun-i-t--namenginx_server_01-v/Users/liwang/docker/nginx_data:/data-p80:80centos/bin/bash 将文件copy至容器中 liwangdeMacBook-Air:~liwang$dockercpDownloads/nginx-1.14.0.tar.gznginx_server_01:/soft/nginx-1.14.0.tar.gz 解压 [root@e46ae471064esoft]#tarxf/soft/nginx-1.14.0.tar.gz-C/soft/ 安装之前修改源码屏蔽名称以及版本号 [root@e46ae471064ecore]#ls-l"/soft/nginx-1.14.0/src/core/nginx.h" -rw-r--r--110011001476Apr1715:22/soft/nginx-1.14.0/src/core/nginx.h [root@e46ae471064ecore]# ------------------------------------------------------ #defineNGINX_VERSION"0.0.1" #defineNGINX_VER"HaiYan/"NGINX_VERSION #defineNGINX_VAR"HaiYan" ------------------------------------------------------ #defineNGINX_VERSION"1.14.0" #defineNGINX_VER"nginx/"NGINX_VERSION #defineNGINX_VAR"NGINX" ------------------------------------------------------ 安装插件 [root@e46ae471064e~]#yuminstallpcrepcre-develgccgcc-c++makeopensslopenssl-devel-y 添加用户 [root@e46ae471064enginx-1.14.0]#useraddnginx-s/sbin/nologin-M 安装 [root@e46ae471064enginx-1.14.0]#./configure--prefix=/usr/local/nginx--with-http_ssl_module--with-http_stub_status_module--user=nginx--group=nginx [root@e46ae471064enginx-1.14.0]#make [root@e46ae471064enginx-1.14.0]#makeinstall 利用curl工具获取服务器信息 [root@e46ae471064enginx]#curl-Ilocalhost HTTP/1.1200OK Server:HaiYan/0.0.1 Date:Tue,01May201814:39:56GMT Content-Type:text/html Content-Length:612 Last-Modified:Tue,01May201814:33:26GMT Connection:keep-alive ETag:"5ae87ab6-264" Accept-Ranges:bytes [root@e46ae471064enginx]# nginx虚拟主机配置 基于域名的虚拟主机 [root@e46ae471064econf]#catnginx.conf|grep-v"#"|grep-v"^$">>extra/www.conf 修改www.conf [root@e46ae471064eextra]#catwww.conf server{ listen80; server_namewww.wang-li.top; location/{ roothtml/www; indexindex.htmlindex.htm; } error_page500502503504/50x.html; location=/50x.html{ roothtml; } } [root@e46ae471064eextra]# 修改nginx.conf在http区间增加,includeextra/*;这行 [root@e46ae471064econf]#catnginx.conf|grep-v"#"|grep-v"^$" worker_processes1; events{ worker_connections1024; } http{ includemime.types; default_typeapplication/octet-stream; sendfileon; keepalive_timeout65; server{ listen80; server_namelocalhost; location/{ roothtml; indexindex.htmlindex.htm; } error_page500502503504/50x.html; location=/50x.html{ roothtml; } } includeextra/*; } [root@e46ae471064econf]# 增加html/www/index.html文件 [root@e46ae471064econf]#ls/usr/local/nginx/html/www/index.html-l -rw-r--r--1rootroot613May114:50/usr/local/nginx/html/www/index.html [root@e46ae471064econf]# 修改hosts文件,访问 [root@e46ae471064econf]#cat/etc/hosts|grepwww.wang-li.top 127.0.0.1 www.wang-li.top [root@e46ae471064econf]#curl-Iwww.wang-li.top HTTP/1.1200OK Server:HaiYan/0.0.1 Date:Tue,01May201814:54:41GMT Content-Type:text/html Content-Length:613 Last-Modified:Tue,01May201814:50:21GMT Connection:keep-alive ETag:"5ae87ead-265" Accept-Ranges:bytes [root@e46ae471064econf]# 基于端口的虚拟主机 修改www.conf基于端口的访问,如下: [root@e46ae471064eextra]#catwww.conf server{ listen8081; server_namewww.wang-li.top; location/{ roothtml/www; indexindex.htmlindex.htm; } error_page500502503504/50x.html; location=/50x.html{ roothtml; } } [root@e46ae471064eextra]# reloadnginx访问如下 [root@e46ae471064eextra]#/usr/local/nginx/sbin/nginx-t nginx:theconfigurationfile/usr/local/nginx/conf/nginx.confsyntaxisok nginx:configurationfile/usr/local/nginx/conf/nginx.conftestissuccessful [root@e46ae471064eextra]#/usr/local/nginx/sbin/nginx-sreload [root@e46ae471064eextra]#curl-Iwww.wang-li.top:8081 HTTP/1.1200OK Server:HaiYan/0.0.1 Date:Tue,01May201814:56:48GMT Content-Type:text/html Content-Length:613 Last-Modified:Tue,01May201814:50:21GMT Connection:keep-alive ETag:"5ae87ead-265" Accept-Ranges:bytes [root@e46ae471064eextra]# 基于IP的虚拟主机 获取容器ip liwangdeMacBook-Air:~liwang$dockerinspect-f{{.NetworkSettings.IPAddress}}nginx_server_01 172.17.0.2 liwangdeMacBook-Air:~liwang$ 修改www.conf如下 [root@e46ae471064eextra]#catwww.conf server{ listen172.17.0.2:8082; server_namewww.wang-li.top; location/{ roothtml/www; indexindex.htmlindex.htm; } error_page500502503504/50x.html; location=/50x.html{ roothtml; } } [root@e46ae471064eextra]# 访问如下: [root@e46ae471064eextra]#curl-I172.17.0.2:8082 HTTP/1.1200OK Server:HaiYan/0.0.1 Date:Tue,01May201815:00:44GMT Content-Type:text/html Content-Length:613 Last-Modified:Tue,01May201814:50:21GMT Connection:keep-alive ETag:"5ae87ead-265" Accept-Ranges:bytes [root@e46ae471064eextra]# nginxstub_status说明 查看系统是否安装此模块 [root@e46ae471064eextra]#/usr/local/nginx/sbin/nginx-V nginxversion:HaiYan/0.0.1 builtbygcc4.8.520150623(RedHat4.8.5-16)(GCC) builtwithOpenSSL1.0.2k-fips26Jan2017 TLSSNIsupportenabled configurearguments:--prefix=/usr/local/nginx--with-http_ssl_module--with-http_stub_status_module--user=nginx--group=nginx [root@e46ae471064eextra]# 发现有--with-http_stub_status_module就是支持的 配置www.conf如下: [root@e46ae471064eextra]#catwww.conf server{ listen80; server_namewww.wang-li.top; location/{ #roothtml/www; #indexindex.htmlindex.htm; stub_statuson; access_logoff; } } [root@e46ae471064eextra]# 访问如下 [root@e46ae471064eextra]#curlwww.wang-li.top Activeconnections:3 serveracceptshandledrequests 212120 Reading:0Writing:1Waiting:2 [root@e46ae471064eextra]# 三个值分别代表: activeconnections:正在处理的连接活动数 212120 第一个表示从启动到现在一共处理了21次请求 第二个表示建立了21次握手 第三个表示总共处理了20次请求 丢包数=握手数-连接数可见,并未丢包 reading:nginx读取到客户端的header信息数 writing:Nginx返回给客户端的header信息数 waiting:Nginx处理完等待下一次请求指令的驻留连接,在开启keep-alive的情况下,这个值等于active-(reading+writing) nginxlog记录日志 访问日志记录: nginx如果不指定format和access,则默认格式为: #log_formatmain\'$remote_addr-$remote_user[$time_local]"$request"\' #\'$status$body_bytes_sent"$http_referer"\' #\'"$http_user_agent""$http_x_forwarded_for"\'; #access_loglogs/access.logmain; 格式参数说明: $remote_addr:访问网站客户端地址 $http_x_forwarded_for:当前端有代理服务器时,设置web节点记录客户端地址配置,此参数前提是服务器进行了相关x_forwarded_for设置 $remote_user:远程客户端用户名称 $time_local:记录访问时间与时区 $request:用户的http起始行信息 $status:http状态码 $body_bytes_sent:服务器发送给客户端相应body字节数 $http_referer:记录此请求时从哪个连接过来的 $http_user_agent:记录客户端的访问信息 关于access_log官方说明: Syntax:access_logpath[format[buffer=size][gzip[=level]][flush=time][if=condition]]; access_logoff; Default: access_loglogs/access.logcombined; Context:http,server,location,ifinlocation,limit_except buffer=size:访问日志缓冲器大小 gzip[=level:压缩级别 flush=time:缓冲器的日志刷新到磁盘时间 if=condition:其他条件 access_logoff:不记录访问日志 nginx_location: 语法: location[=|~|~*|^-]url{ ... } ~和~*的区别:~区分大小写,~*不区分大小写 =:为精确配置 /:为默认配置 其他配置依上至下 nginxrewrite: 语法: rewrite^/(.*)url/$1permanent; 意思是只要匹配如下^/(.*),就跳转至url上,且$1是取前面regex部分括号的内容,结尾的primanent是永久301重定向标记。 regex语法: :去掉特殊字符 ^:起始位置 $:结束位置 *:匹配0次或多次 +:匹配前面的字符一次或多次 ?:匹配前面的字符0次或1次 .:匹配n之外的任何字符 (pattern):匹配括号内字符,并可以在后面匹配,常用$0-$9属性获取值 rewriteflag标记 last:本条规则匹配完成后,继续向下匹配 break:本条规则匹配完成后,不再匹配后面的规则 redirect:返回302临时重定向, permanent:返回301永久重定向 nginx访问认证: 设置密码: [root@e46ae471064econf]#htpasswd-cb/usr/local/nginx/conf/htpasswdliwangliwang 修改conf: [root@e46ae471064econf]#sed-n"48,54p"nginx.conf location/{ roothtml; indexindex.htmlindex.htm; auth_basic"test"; auth_basic_user_file/usr/local/nginx/conf/htpasswd; } [root@e46ae471064econf]#


本文标题:便利贴
网站路径:http://cqcxhl.com/article/cjssig.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP