Nginx 常用伪静态配置
1. /a/b?c=d => index.php?_a=a&_m=b&c=d
2. /xxx/detail-yyy.html => index.php?_a=xxx&_m=detail&id=yyy
server {
listen 80;
server_name my.xh5.com;
location / {
root /mnt/hgfs/web/my.xueh5.com/src/;
index index.html index.htm index.php;
if ($args ~ "^(.*)$"){
set $rule_0 1$rule_0;
set $bref_1 $1;
}
if ($rule_0 = "1"){
rewrite ^([0-9a-zA-Z]*)/detail-([0-9]*)\.html$ /index.php?_a=$1&_m=detail&id=$2&$bref_1 last;
rewrite ^/([0-9a-zA-Z]*)/([0-9a-zA-Z.]*)$ /index.php?_a=$1&_m=$2&$bref_1 last;
rewrite ^/([0-9a-zA-Z]+)$ /index.php?_a=$1&_m=index&$bref_1 last;
rewrite ^/$ /index.php?_a=index&_m=index&$bref_1 last;
}
}
location ~ \.php$ {
root /mnt/hgfs/web/my.xueh5.com/src/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Nginx 常用伪静态配置的更多相关文章
- Nginx 服务器伪静态配置不当造成 Access denied
Nginx 服务器伪静态配置不当造成 Access denied 有群有反馈将 FastAdmin 布署到阿里云后无法打开后台. 出现如下提示,首页是可以打开,点登录链接后出现的.(下是群友的截图) ...
- 【转】 nginx rewrite 伪静态配置参数详细说明
nginx rewrite 伪静态配置参数和使用例子 附正则使用说明 正则表达式匹配,其中: * ~ 为区分大小写匹配 * ~* 为不区分大小写匹配 * !~和!~*分别为区分大小写不匹配及不区分 ...
- Nginx常用功能配置二
Nginx常用功能配置二 Nginx location匹配设置 location作用:可以根据用户请求的URI来执行不同的应用,根据用户请求的网站的地址URL匹配. location语法: locat ...
- Nginx常用功能配置一
Nginx常用功能配置 参数include配置 说明:如果日常工作中server标签存在太多,可以采用include配置模式,Nginx的主配置文件包含的所有虚拟主机的子配置文件会统一放入extra目 ...
- 2.了解nginx常用的配置
作者 微信:tangy8080 电子邮箱:914661180@qq.com 更新时间:2019-07-10 20:56:10 星期三 欢迎您订阅和分享我的订阅号,订阅号内会不定期分享一些我自己学习过程 ...
- nginx常用伪静态设置
nginx里使用伪静态是直接在nginx.conf 中写规则的,并不需要像apache要开启写模块(mod_rewrite)才能进行伪静态. nginx只需要打开nginx.conf配置文件,在ser ...
- nginx常用服务配置
一.nginx.conf的配置方式,创建新vhost user nginx; worker_processes ; worker_cpu_affinity ; worker_rlimit_nofile ...
- nginx常用功能配置
一.规范优化nginx配置文件 nginx的主配置文件为nginx.conf,主配置文件包含的所有虚拟主机的子配置文件会统一放入extra目录中,虚拟主机的配置文件按照网站的域名或功能取名,例如www ...
- Nginx常用伪静态规则(rewrite)-Discuz X3.2-WordPress-PHPCMS-ECSHOP-SHOPE(转)
当我们从apache服务器转向Nginx服务器的时候,它们的伪静态规则就不一样了,所以你熟悉Nginx服务器的伪静态规则,自己写当然也好.不了解Nginx服务器的伪静态规则的,为方便各位站长,收集了这 ...
随机推荐
- 26. Binary Tree Maximum Path Sum
Binary Tree Maximum Path Sum Given a binary tree, find the maximum path sum. The path may start and ...
- Django TemplateView
主要功能是渲染模板,看官例: from django.views.generic.base import TemplateView from articles.models import Articl ...
- iframe中的js
iframe之间的js是不能相互访问的,iframe和父窗体之间的js也是不能相互访问的
- C++设计模式-Factory工厂模式
Factory1.定义创建对象的接口,封装对象的创建2.将实际创建工作延迟到子类中,例如,类A中药使用类B,B是抽象父类,但是在类A中不知道具体要实例化哪一个B的子类,但是在类A的子类D中是可以知道的 ...
- leetcode刷题: 002 Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...
- Python 前端之JS
JavaScript由浏览器编译运行 JS的导入方式有两种,一种直接定义,第二种通过src引入:可以存放在<head>头部,但是强烈建议放在<body>的最下面,因为如果你引入 ...
- maven自动部署到远程tomcat教程
使用maven的自动部署功能可以很方便的将maven工程自动部署到远程tomcat服务器,节省了大量时间. 本文章适用于tomcat的7.x ,8.x, 9.x版本. 下面是自动部的步骤 1,首先,配 ...
- ajax实现文件下载
前台: <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> ...
- CSS 知识汇总
1: inline-block 元素 IE6 7下只有 inline 的元素有 inline-block, 比如 span元素,如果要使其它元素有 inline-block,比如 div 有 in ...
- PHP生成静态页
代码如下: <? function makedir($mudir) //创建目录 { $file = "./$mudir"; @mkdir($file,07 ...