nginxnginx是一款轻量级的web服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器nginx是个高性能web和反向代理服务器nginx由内核和模块组成nginx的特性与优点‘特性:使用epollandkqueue作为开发模型在高连接并发的情况下,nginx是apache服务器不错的替代品,能够支持高达50000个并发连接数的响应nginx作为负载均衡服务器,既可在内部直接支持
分类:
其他好文 时间:
2018-08-30 20:39:32
阅读次数:
200
1 function showLog($content,$filename="filenamelog") 2 { 3 $logfile = 'logs/'.$filename.date('Ymd').'.txt'; 4 if(!file_exists(dirname($logfile))) 5 { ... ...
分类:
Web程序 时间:
2018-08-29 21:23:59
阅读次数:
240
配置方法一(可用): 配置方法二(可用): #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; # ...
分类:
其他好文 时间:
2018-08-24 16:09:32
阅读次数:
151
编译模块-bash-4.1#./sbin/nginx-Vnginxversion:nginx/builtbygcc4.4.720120313(RedHat4.4.7-3)(GCC)builtwithOpenSSL1.0.1e-fips11Feb2013TLSSNIsupportenabledconfigurearguments:--with-http_ssl_module--with-http_s
分类:
其他好文 时间:
2018-08-24 16:03:34
阅读次数:
306
生成器
只要在函数体内出现yield关键字,那么再执行函数就不会执行函数代码,会得到一个结果,该结果就是生成器。
生成器就是迭代器。
def foo():
print(‘add‘)
yield 1
print(‘sidhi‘)
yield 2
g=foo()
next(g)
res1=next(g)
print(res1)
yield的功能:
1.yield为我们提供了一种自定义迭代器对象的方法。
2.yield与retuen的区别,yield可以返回多次值,所以函数的暂停与继续的转态由yield帮我们保存的。
例:range的编写 #range(1,10,2)
def bar(x,y,z):
while x <= y:
yield x
x+=z
g=bar(1,10,2)
print(next(g))
案例:编写tail -f error.log |grep ‘abc‘
import time
def foo(file):
with open(file,‘rb‘) as f:
f.seek(0,2) #光标直接到末尾
分类:
其他好文 时间:
2018-08-22 21:54:04
阅读次数:
170
#user nobody; ### 工作进程数,可以根据 CPU 核心数量来配置 worker_processes 1; ### 错误日志文件位置 #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs... ...
分类:
其他好文 时间:
2018-08-21 19:45:32
阅读次数:
161
为了加强安全性,MySQL5.7为root用户随机生成了一个密码,在error log中,关于error log的位置,如果安装的是RPM包,则默认是/var/log/mysqld.log。 一般可通过log_error设置 mysql> select @@log_error; + + | @@lo ...
分类:
数据库 时间:
2018-08-20 11:30:53
阅读次数:
180
安装nginx 配置文件和之前的一样 user nobody nobody;#定义Nginx运行的用户和用户组 worker_processes 4;#nginx进程数,建议设置为等于CPU总核心数。 error_log logs/error.loginfo;#全局错误日志定义类型,[ debug ... ...
分类:
其他好文 时间:
2018-08-16 11:23:15
阅读次数:
172
Debian,Ubuntu或Linux Mint上的Apache错误日志位置 默认的错误日志 在基于Debian的Linux上,系统范围的Apache错误日志默认位置是/var/log/apache2/error.log。默认位置可以通过编辑Apache的配置文件进行修改。 自定义的错误日志 要找到 ...
分类:
Web程序 时间:
2018-08-11 21:58:33
阅读次数:
201
为了简单就在windows上介绍一下了nginxsteam模块转发tcp对socket做负载均衡配置如下:worker_processes1;error_loglogs/error.log;error_loglogs/error.lognotice;error_loglogs/error.loginfo;pidlogs/nginx.pid;events{worker_connections1024
分类:
其他好文 时间:
2018-08-09 11:10:44
阅读次数:
1248