Nginx日志主要分为两种:访问日志和错误日志.日志开关在Nginx配置文件(一般在server段来配置)中设置,两种日志都可以选择性关闭,默认都是打开的. 访问日志access_log #日志格式设定 log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_us…
概述 重写URL是非常有用的一个功能,因为它可以让你提高搜索引擎阅读和索引你的网站的能力:而且在你改变了自己的网站结构后,无需要求用户修改他们的书签,无需其他网站修改它们的友情链接:它还可以提高你的网站的安全性:而且通常会让你的网站更加便于使用和更专业. Nginx Rewrite规则相关指令 Nginx Rewrite规则相关指令有if.rewrite.set.return.break等,其中rewrite是最关键的指令. Rewrite 重写,写在server段或者location段都可,后…
nginx的官方手册: http://nginx.org/en/docs/ 编译安装 下载地址: http://nginx.org/en/download.html # 为了支持rewrite功能,我们需要安装pcre yum install pcre* # 安装openssl,如果不需要ssl支持,请跳过这一步 yum install openssl* # 编译 ./configure --prefix=/usr/local/nginx-1.5.1 \ --with-http_ssl_modu…
官方:http://nginx.org nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by Igor Sysoev. For a long time, it has been running on many heavily loaded Russian sites including…
配置文件说明 #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为当前主机的CPU总核心数. worker_processes 8; #全局错误日志定义类型,[ debug | info | notice | warn | error | crit ] error_log ar/loginx/error.log info; #进程文件 pid /usr/local/nginx/logs/nginx.pid; #一个nginx进程打开的最多文件描述符数目,…
概述 location 有"定位"的意思, 根据Uri来进行不同的定位. 在虚拟主机的配置中,是必不可少的,location可以把网站的不同部分,定位到不同的处理方式上.伪静态,反向代理,负载均衡等等都离不开location. 语法 location [=|~|~*|^~] patt {} 中括号可以不写任何参数,此时称为一般匹配,也可以写参数.因此,大类型可以分为3种: location = patt {} [精准匹配] location patt{} [一般匹配] location…
Apache默认是把PHP作为本身的一个模块(mod_php)来运行的,而Nginx是以FastCGI方式运行的.所以使用Nginx+PHP就是直接配置为FastCGI模式. 安装PHP 下载地址: http://php.net/downloads #下载PHP cd /usr/local/src/ wget http://cn2.php.net/distributions/php-5.5.0.tar.gz #安装依赖包 yum -y install gcc make gd-devel libj…
nginx location =:精确匹配(必须全部相等) ~:大小写敏感,正则匹配 ~*:忽略大小写,正则匹配 ^~:只需匹配uri部分,精确匹配 @:内部服务跳转,精确匹配 优先级: Exact match = Forward match ^~ / Case sensitive regex ~ / Case insensitive regex ~* Path match / 规则 精确匹配规则是“最大前缀”.正则匹配规则是“顺序匹配”,只要匹配到第一个就停止后面的匹配.通用匹配 “/”最后匹…
在写伪静态的时候,可以先用一个打印$_GET的PHP文件来测试,并且一定注意浏览器缓存,另外正则里如果有"{}",正则要用双引号包起来 dedecms location / { rewrite "^/index.html$" /index.php last; rewrite "^/list-([0-9]+)\.html$" /plus/list.php?tid=$1 last; rewrite "^/list-([0-9]+)-([0-…
nginx系列友情链接:nginx高性能WEB服务器系列之一简介及安装https://www.cnblogs.com/maxtgood/p/9597596.htmlnginx高性能WEB服务器系列之二命令管理https://www.cnblogs.com/maxtgood/p/9597990.htmlnginx高性能WEB服务器系列之三版本升级https://www.cnblogs.com/maxtgood/p/9598113.htmlnginx高性能WEB服务器系列之四配置文件详解https:…