• Nginx status状态开启方法介绍

    日期:

    开启方法: 复制代码 代码示例: server { ... location /nginx_status { stub_status on; access_log off; allow 123.123.123.123; # 允许访问的 IP allow 127.0.0.1; deny all; } } 说明: active connections 当前Nginx正处理的活动连接数。 serveraccepts...

  • nginx缓存本地静态文件

    日期:

    使用nginx缓存本地静态文件,由同一个nginx来解析。 使用if不能嵌套,所以只能使用本地的IP跳转一下,我的cache使用的nginx命名cache_one配置如下。 如果本地跳转有问题可以再hosts表中修改一下指向。 ##---pic 复制代码 代码如下: upstream local_img { ser...

  • nginx open_file_cache指令 导致静态文件不能及时更新和出现网页

    日期:

    做一个文字直播的项目,为了减轻数据库及web服务器负载,做了以下处理: web前端有CDN,由于直播需要时效性,所以缓存不能太久,可以配置nginx对静态文件的缓存时间: 复制代码 代码如下: location ~ ^/zhibo/.*\.(html)$ { root /data/www; expires 30s; }...

  • nginx运行php"No input file specified"错误的解决方法

    日期:

    打开一个页面?phpphpinfo(); ? 然后在游览器下运行:页面提示 No input file specified. FastCGI模式下访问php文件时,出现No input file specified.错误 查看access.log 发现是 404 原因分析 : 1、任何对.php文件的请求,都简单地交给php-cgi去处理,但没...

  • 通过例子来看nginx下的Rewrite规则

    日期:

    Apache下的Rewrite规则是详细的规则,nginx下的中文文档好像没有看到,这里有个英文的文档:http://wiki.nginx.org/NginxHttpRewriteModule。 Apache下的Rewrite规则基本上到nginx下,也可以直接使用,不行的话用引号引起来一般就都可以了。 nginx的rewrite...

  • nginx中“nginx could not build the server_names_hash”的解决

    日期:

    问题:在一个服务器中增加了一些站点别名,差不多有20多个吧,重启nginx时,有如下的错误提示: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32 解决方法: 在配置文件的http{}段增加一行配置: server_nam...

  • nginx php配置与nginx启动脚本

    日期:

    nginx中php配置,sh脚本来启动、关闭、重启nginx。 一、配置文件 nginx.conf 复制代码 代码如下: server { listen 8080 ; server_name localhost; location / { root /home/work/htdocs; expires 1d; autoindex on; index index.php index.html; } location...

  • Nginx+PHP(FastCGI)遇到no input file specified的解决方法

    日期:

    配置完成Nginx+PHP+MySQL环境以后,稳定运行几个月,但是最近发现有个问题,如果请求的PHP文件不存在,不是报404错误,而是出现no input file specified的提示。 检查问题,分析原因: 在于Nginx没有检查这个PHP文件是否存在,直接把所有PHP文件都交由后端ph...

  • 教你在Gentoo中配置Nginx+MySQL+PHP(FastCGI)环境

    日期:

    教你在Gentoo中配置Nginx+MySQL+PHP(FastCGI)环境,有需要的朋友可以参考下。 安装 Nginx * 一条命令搞定: USE=fastcgiemergenginx * 新建用户和组: groupadd www useradd www -g www Nginx 安装好后默认会添加 nginx 组和 nginx 用户,不过我本身还是习...

  • 实例学习nginx的cache功能

    日期:

    实例学习nginx的cache功能,供大家学习参考。 一.nginx的proxy_cache模块,据说比squid对多核的支持好很多 。 复制代码 代码如下: #所需软件: wget http://labs.frickle.com/files/ngx_cache_purge-1.3.tar.gz pcre,nginx-0.8.29.tar.gz # purge模块 http://...