nginx下配置Yii2 rewrite、pathinfo等
环境说明:
我试用的lnmp安装包安装的nginx,nginx版本是1.14.1
server {
listen ;
server_name www.baidu.com;
#access_log /data/wwwlogs/access_nginx.log combined;
root /data/wwwroot/wechatadmin/backend/web;
#root /data/wwwroot/game;
index index.html index.htm index.php;
#error_page /.html;
#error_page /.html;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
} location / {
try_files $uri $uri/ /index.php?$query_string;
} if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$ permanent;
} # 去除index action
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$ permanent;
} # 根据laravel规则进行url重写
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$ last;
break;
}
#error_page /50x.html;
location = /50x.html {
root html;
}
}
nginx下配置Yii2 rewrite、pathinfo等的更多相关文章
- nginx下配置laravel+rewrite重写
server { listen ; server_name ha.d51v.cn; #access_log /data/wwwlogs/access_nginx.log combined; root ...
- Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持
前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fi ...
- 如何在Nginx下配置PHP程序环境
1.nginx与PHP的关系 首先来看nginx与php的关系, FastCGI的关系(而不是像apache那样安装成nginx的模块) FastCGI的意思是, 快速的通用网关接口:CGI Comm ...
- Nginx下WordPress的Rewrite
最近接触WP Super Cache,该插件要求固定链接必须是重写的,故用到Rewrite. 我的是这样配置的: /usr/local/nginx/conf/rewrite/wordpress.con ...
- codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法
codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法 进入nginx的配置文件 加上一句(本来就有这句,只需要修改一下就行了) locatio ...
- NGINX下配置404错误页面的方法分享
NGINX下配置自定义的404页面是可行的,而且很简单,只需如下几步,需要的朋友可以参考下 1. 创建自己的404.html页面 2.更改nginx.conf在http定义区域加入: fastcg ...
- Ubuntu Nginx下配置网站ssl实现https访问
最近在看 HTTP权威指南 看到介绍了HTTPS的ssl,自己就动手测试了下,将步骤记录下 HTTPS简介 什么是HTTPS?百科是这样解释的.HTTPS(全称:Hyper Text Trans ...
- tpadmin的坑收集 nginx下配置tp5失败
如下: 1.ADMIN模块如要关联查询,model的函数名一定不要有“_”下划线,否则找不到 /common/model/**.php 如果把函数名file写成“**_file”,调用时,$vo.** ...
- nginx下配置多个web服务
参考 nginx配置详解 nginx反向代理与负载均衡详解 一.nginx简介: Nginx("engine x")是一款是由俄罗斯的程序设计师Igor Sysoev所开发高性能 ...
随机推荐
- 01-----jQuery介绍
安装node.js cmd查看 node -v npm -v npm init --yes 初始化 npm install jquery --save 1.为什么要使用jQuery ...
- JS——制作简单的网页计算器
用JS做了一个简易的网页计算器 <!DOCTYPE html> <html lang="en"> <head> <meta charset ...
- POI Java 导出数据到Excel
<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifac ...
- Python 配置文件加载且自动更新(watchdog)
安装依赖:pip install watchdog #!/usr/bin/env python3 # -*- coding: utf-8 -*- import logging import os im ...
- jsp内置对象和el表达式内置对象误区
未经允许禁止转载... jsp九大内置对象 EL表达式隐含的11个对象 隐含对象名称 描 述 pageContext 对应于JSP页面中的pageContext对象(注意:取的是pageC ...
- enable orgmode latex preview to support retina on mac
Table of Contents 1. enable orgmode latex preview to support retina on mac 1.1. get the proper versi ...
- 从零开始的全栈工程师——js篇2.9(this详解)
this 一.this是js的一个关键字 指定一个对象然后去替代他 只研究函数内的this 分两种 函数内的this和函数外的this1)函数内的this指向行为发生的主体2)函数外的this都 ...
- android sqlite 递归删除一棵子树
背景:android studio 3.0 GreenDao 目标:在android 中,如何做到递归删除某颗子树?? ======================================== ...
- 构建第一个Spring Boot2.0应用之集成dubbo上---环境搭建(九)
一.环境: Windows: IDE:IntelliJ IDEA 2017.1.1 JDK:1.8.0_161 Maven:3.3.9 springboot:2.0.2.RELEASE Linux(C ...
- sql & sqlalchemy join多个表
# 连接两个数据表的用法: FROM Member INNER JOIN MemberSort ON Member.MemberSort=MemberSort.MemberSort # 语法格式可以概 ...