成都创新互联网站制作重庆分公司

Yii2如何配置Nginx伪静态-创新互联

这篇文章将为大家详细讲解有关Yii2如何配置Nginx伪静态,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

创新互联公司专业网站设计、成都网站制作,集网站策划、网站设计、网站制作于一体,网站seo、网站优化、网站营销、软文发布平台等专业人才根据搜索规律编程设计,让网站在运行后,在搜索中有好的表现,专业设计制作为您带来效益的网站!让网站建设为您创造效益。

具体如下:

主要检查以下代码:

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;
  }
}

关于“Yii2如何配置Nginx伪静态”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


本文题目:Yii2如何配置Nginx伪静态-创新互联
地址分享:http://cxhlcq.com/article/idejo.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部