共 22 篇文章 |
|
测试新版的nginx可执行程序是否正常:[root@test1 nginx-1.7.4]# cd /usr/local/nginx/sbin/[root@test1 sbin]# lsnginx nginx.old[root@test1 sbin]# ./nginx -t -c /usr/local/nginx/conf/nginx.confnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.co... 阅405 转4 评0 公众公开 14-12-11 18:04 |
nginx不得不说的参数之 为什么nginx error.我们在nginx中配置了error_page 异常跳转的规则,预期当后端java容器出现异常错误的时候,对应的请求会被nginx转发到我们静态降级的服务,但是实际上,当后端java容器出现异常或者过载的时候,nginx是直接吐出java容器后端的异常信息。fastcgi_intercept_errors on表示接收fastcgi输出的http 1.0 resp... 阅3379 转4 评0 公众公开 14-12-11 17:23 |
思路上述两种方法均会耗费服务器的资源,我们用curl访问baidu.com试一下,看百度的公司是如何实现baidu.com向www.baidu.com的跳转可以看到百度很巧妙的利用meta的刷新作用,将baidu.com跳转到www.baidu.com.因此我们可以基于http://test.com的虚拟主机路径下也写一个index.html,内容就是http向https的跳转index.html<html> <meta ht... 阅756 转2 评0 公众公开 14-12-11 16:57 |
由于是使用openssl架设私有证书中心,因此要保证以下字段在证书中心的证书、服务端证书、客户端证书中都相同。mkdir /usr/local/nginx/ssl cd /usr/local/nginx/ssl (umask 077;openssl genrsa -out nginx.key 1024) openssl req -new -key nginx.key -out nginx.csr openssl ca -in nginx.csr -out nginx.crt -days=36504、创建客户端浏览器证... 阅198 转1 评0 公众公开 14-12-11 10:22 |
其中 nginx 的配置文件存放于 conf/nginx.conf,nginx 只有一个程序文件位于 sbin 目录下。确保系统的 80 端口没被其他程序占用,运行 sbin/./nginx 命令来启动 Nginx,打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 nginx 已经安装并运行成功。注:此处采用sbin/./nginx命令启动是因为我这里如果用网上说的sbin/nginx... 阅130 转3 评0 公众公开 14-12-09 20:24 |
cd /usr/local/srcwget http://nginx.org/download/nginx-1.4.2.tar.gztar -zxvf nginx-1.4.2.tar.gzcd nginx-1.4.2./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.34 --with-zlib=/usr/local/src... 阅38 转2 评0 公众公开 14-12-01 18:48 |
PID PPID USER %CPU VSZ WCHAN COMMAND33126 1 root 0.0 1164 pause nginx: master process /usr/local/nginx/sbin/nginx36264 33126 root 0.0 1148 pause nginx: master process /usr/local/nginx/sbin/nginx36265 36264 nobody 0.0 1364 kqread nginx: worker process (nginx)36266 36264 nobody 0.0 1364 kqread nginx: worker process (ngi... 阅118 转2 评0 公众公开 14-12-01 15:59 |
HTTP Headers模块这组指令主要用来设置Nginx返回网页内容给用户时,附件的Header头信息.(1)add_header指令当HTTP应答状态码为200,204,301,302,或304时,增加指定的Header头,其中Header头的值可以使用变量.(2)expires指令使用本指令可以控制HTTP应答中的"Expires"和"Cache-Control"的Header头信息,起到控制浏览器页面缓存的作... 阅90 转2 评0 公众公开 14-11-21 19:45 |
nginx 日志分割shell脚本。#move nginx logs.mv $logspath/v17go.com.log $savepath/$(date +%Y)$(date +%m)/v17go.com_$(date +%Y%m%d).logmv $logspath/access.log $savepath/$(date +%Y)$(date +%m)/access_$(date +%Y%m%d).logmv $logspath/error.log $savepath/$(date +%Y)$(date +%m)/error_$(date +%Y%m%d).log.kill -USR1 `cat /usr/lo... 阅302 转2 评0 公众公开 14-11-09 16:31 |
Nginx日志分割Shell脚本,按天分类存储并删除超过7天的日志。如果使用LNMP网站环境的话,默认nginx只会生成一个访问日志,并且是在每天的积累,日志文件会变的非常大,如果需要做一下日志的分析,无论是使用脚本分析,还是把日志下载本地分析,都不太方便。每天分割Nginx的访问日志,有利于分析日志。需要注意的是:因为个人需要,Nginx访问日... 阅580 转4 评0 公众公开 14-11-09 16:29 |