摘要: 1 gzip模块 参考:http://nginx.org/en/docs/http/ngx_http_gzip_module.html 浏览器的请求头里会表明Accept-Encoding 方式。服务器收到请求,就把内存按格式压缩,发给浏览器,响应头里会说明Content-Encoding和Cont 阅读全文
posted @ 2018-06-30 18:18 jabbok 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 在服务器的响应头中,有Content-Type一行,表明传输的http媒体类型。 比如:txt文件就用text/plain 表明。 conf/mime.type 阅读全文
posted @ 2018-06-30 17:59 jabbok 阅读(297) 评论(0) 推荐(0) 编辑
摘要: $args, 请求中的参数; $content_length, HTTP请求信息里的"Content-Length"; $content_type, 请求信息里的"Content-Type"; $document_root, 针对当前请求的根路径设置值; $document_uri, 与$uri相同 阅读全文
posted @ 2018-06-29 14:50 jabbok 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 1 需求 一台服务器的nginx上如果需要运营多个网站,或者把二级域名拆分成不同的web映射目录。就需要使用vhost。web client上请求不同的域名,nginx会根据vhost里的server conf加载不同的配置。 2 配置 conf/nginx.conf 不需要server标签,只要在 阅读全文
posted @ 2018-06-29 11:55 jabbok 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 1 安装php5.6 首先确保mysql已安装 碰到一些依赖问题 2 nginx对php的转发配置 nginx本身只处理静态网页,对于php网页,则专门做一个location映射,转发到php-fpm进程(默认监听在127.0.0.1 9000),然后php-fpm到对应的document_root 阅读全文
posted @ 2018-06-28 14:09 jabbok 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 参考:http://nginx.org/en/docs/http/ngx_http_rewrite_module.html 1 语法 2 测试 2.1 精确匹配/return code 2.2 正则匹配/rewrite 2.3 是否存在/fastcgi_para 2.4 设定变量 3 反向引用 阅读全文
posted @ 2018-06-27 14:17 jabbok 阅读(515) 评论(0) 推荐(0) 编辑
摘要: 简单点的方法: 写个定时任务: cd /root/onlinezip log.out.$date.zip log.out> log.out#find ./ -name *.zip -ctime +7 | xargs rm -f 或者 0 03 * * * if [ -d /opt/logs ];th 阅读全文
posted @ 2018-06-25 11:23 jabbok 阅读(807) 评论(0) 推荐(0) 编辑
摘要: 0 conf结构 分三大部分:全局区/events/http。默认conf 如下 1 全局区 worker_processes 8; #设定工作进程数,一般等于core数就行。每个进程跑一个core。 #error_log logs/error.log debug;#error_log logs/e 阅读全文
posted @ 2018-06-22 15:07 jabbok 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 1 最小化安装碰到的依赖问题 阅读全文
posted @ 2018-06-21 21:57 jabbok 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 检查版本与配置项 指定配置文件启动 检查conf语法是否正确 平滑重启,重读conf 如果修改./nginx/conf/nginx.conf,nginx不重启不会重新加载新的conf。例如:我修改默认的location / ,把ab.html放在第一访问序列。不重启,则仍是访问index.html 阅读全文
posted @ 2018-06-21 21:56 jabbok 阅读(387) 评论(0) 推荐(0) 编辑