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所开发高性能 ...
随机推荐
- dos for循环
in (phone.txt) do ( 127.0.0.1 > tmp_file ) ) do ( 127.0.0.1 > tmp_file )
- 20-----定位 (Position)
定位 定位有三种: 1.相对定位 2.绝对定位 3.固定定位 这三种定位,每一种都暗藏玄机,所以我们要一一单讲. 相对定位 相对定位:相对于自己原来的位置定位 现象和使用: 1.如果对当前元素仅仅设置 ...
- 【ACM】吝啬的国度 - DFS (图)
吝啬的国度 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 在一个吝啬的国度里有N个城市,这N个城市间只有N-1条路把这个N个城市连接起来.现在,Tom在第S号城市, ...
- python3——“->”的含义
->:标记返回函数注释,信息作为.__annotations__属性提供,__annotations__属性是字典.键return是用于在箭头后检索值的键.但是在Python中3.5,PEP 4 ...
- int,long,long long的数据范围
unsigned int 0-4294967295 int 2147483648-2147483647 unsigned long 0-4294967295long 2147483 ...
- 使用Java生成带有下划线字体的文字
HashMap<TextAttribute, Object> hm = new HashMap<TextAttribute, Object>(); hm.put(TextAtt ...
- 八个cmd 命令
一,ping 它是用来检查网络是否通畅或者网络连接速度的命令.作为一个生活在网络上的管理员或者黑客来说,ping命令是第一个必须掌握的DOS命令,它所利用的原理是这样的:网络上的机器都有唯一确定的IP ...
- npm安装使用淘宝代理的方法(设置registry参数)
公司防火墙问题导致 npm下载失败,安装使用cnpm不知道什么原因抽筋, 还有一个简单的办法,就是npm安装模块时,设置代理: npm install -g vue-cli --registry=ht ...
- html 02-认识html
1. HTML 初识 HTML 指的是超文本标记语言 (Hyper Text Markup Language)是用来描述网页的一种语言. HTML 不是一种编程语言,而是一种标记语言 (markup ...
- logback的configuration
logback的<configuration>只有三个属性: 1.scan[boolean]:当scan被设置为true时,当配置文件发生改变,将会被重新加载.默认值为true. 2.sc ...