主要检查以下代码:

 location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php?$args;
}

完整代码:

server {
charset utf-8;
client_max_body_size 128M; listen 80; ## listen for ipv4
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name mysite.local;
root /path/to/basic/web;
index index.php; access_log /path/to/basic/log/access.log;
error_log /path/to/basic/log/error.log; location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php?$args;
} # uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html; location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri =404;
} location ~ /\.(ht|svn|git) {
deny all;
}
}

参考:http://www.yiiframework.com/doc-2.0/guide-start-installation.html#configuring-web-servers

来源:http://www.getyii.com/topic/31

Yii2 配置 Nginx 伪静态的更多相关文章

  1. nginx伪静态配置教程总结

    在nginx中配置伪静态,也就是常说的url重写功能,只需在nginx.conf配置文件中写入重写规则即可. 当然,这个规则是需要熟悉正则表达式,只掌握nginx自身的正则匹配模式即可,对正则不了解的 ...

  2. php ci nginx 伪静态rewrite配置方法

    php ci nginx 伪静态rewrite配置方法 location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$ ...

  3. Nginx伪静态配置和常用Rewrite伪静态规则集锦

    伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把php文件伪静态成html文件,这种相当简单的,下面我来介绍nginx 伪静态配置方法 nginx里使用伪静态是直接在nginx.conf ...

  4. apache上.htaccess转向nginx上配置.htaccess伪静态规则

    nginx上配置.htaccess伪静态规则 在apache上.htaccess转向,只要apache编译的时候指明支持rewrite模块即可. 但是换到nginx上方法会有不同,有人说把.htacc ...

  5. [转]Nginx伪静态配置和常用Rewrite伪静态规则集锦

    Nginx伪静态配置和常用Rewrite伪静态规则集锦 作者: 字体:[增加 减小] 类型:转载 时间:2014-06-10 我要评论 伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把ph ...

  6. phpstudy配置php7.1.11 + phpstudy nginx伪静态

    切记要把新的php版本配到环境变量,cmd才会生效 php7.1.11下载地址 http://windows.php.net/download/ 下载之后,解压. 重名的为php-7.1.11-nts ...

  7. php配置伪静态如何将.htaccess文件转换 nginx伪静态文件

    php通常设置伪静态三种情况,.htaccess文件,nginx伪静态文件,Web.Config文件得形式,如何将三种伪静态应用到项目中呢, 1,.htaccess文件 实例 <IfModule ...

  8. nginx 伪静态

    伪静态是一种可以把文件后缀改成任何可能的一种方法,如果我想把php文件伪静态成html文件,这种相当简单的,下面来介绍nginx 伪静态配置方法有需要了解的朋友可参考 nginx只需要打开nginx. ...

  9. LNMP安装Let’s Encrypt 免费SSL证书方法:自动安装与手动配置Nginx

    前几天介绍了最新StartSSL免费SSL申请与配置,很多人看到部落介绍SSL证书安装时总是推荐了OneinStack,因为OneinStack提供了一键添加和配置Let's Encrypt 免费SS ...

随机推荐

  1. C语言程序设计--宏和预处理

    C语言宏 宏定义常量 #include <stdio.h> #define SIZE 100 #define BANNER "WARNING:" int main(vo ...

  2. matlab的m程序转执行文件exe

    转换主要有两步: 第一步 设置编译器 在命令窗口输入 mbuild -setup 根据提示操作即可,.如下图我的设置 第二步 转换执行文件 命令行输入 mcc -m main   即可(输入 mcc ...

  3. HTML display:inline-block

    元素转换 display:block;   行内转块 Display:inline;   块转行内 Display:inline-block;  块或行内转行内块 链接伪类 a:link{属性:值;} ...

  4. ssh连接超时时间(ssh timeout)的设置方法

    问题:当某台远程主机宕机时,ssh远程过去会耗费很多的时间去连接,结果还是会失败. 这个时候可以设置超时时间 ssh -o ConnectTimeout= 192.168.0.10

  5. 2018上C语言程序设计(高级)作业- 第4次作业

    作业要求一 1.设计思路: 第一步:首先通过cmd进行判断 第二步:根据题目写的分别进入不同的判断函数,进行逐一判断: 2.实验代码: #include <stdio.h> #includ ...

  6. HttpClient 学习整理【转】

    转自 http://www.blogjava.net/Alpha/archive/2007/01/22/95216.html HttpClient 是我最近想研究的东西,以前想过的一些应用没能有很好的 ...

  7. zero-shor learning 数据集

    OSR数据集下载地址: http://people.csail.mit.edu/torralba/code/spatialenvelope/ Relative Attributes Marr Priz ...

  8. (sklearn)机器学习模型的保存与加载

    需求: 一直写的代码都是从加载数据,模型训练,模型预测,模型评估走出来的,但是实际业务线上咱们肯定不能每次都来训练模型,而是应该将训练好的模型保存下来 ,如果有新数据直接套用模型就行了吧?现在问题就是 ...

  9. HDU-5965 扫雷 模拟+想法

    http://acm.hdu.edu.cn/showproblem.php?pid=5965 (合肥)区域赛签到题...orz 题意:3*n的地图上扫雷(规则就是正常扫雷),中间一排全部没有雷,且全部 ...

  10. Why should we typedef a struct so often in C? - Stack Overflow

    https://stackoverflow.com/questions/252780/why-should-we-typedef-a-struct-so-often-in-c As Greg Hewg ...