Skip to content
DavidLee edited this page Feb 8, 2017 · 2 revisions

Welcome to the yiicms wiki!

nginx 配置参考

server {
    listen       80;
    server_name dev.yiicms.co;
    index index.php;
    root  /var/www/yiicms/web/;
    error_page 404 = /404.html;
    location ~ \.php
    {
            try_files $uri =404;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
            set $path_info "";
            set $real_script_name $fastcgi_script_name;
            if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                    set $real_script_name $1;
                    set $path_info $2;
            }
            fastcgi_param SCRIPT_FILENAME

            $document_root$real_script_name;
            fastcgi_param SCRIPT_NAME $real_script_name;
            fastcgi_param PATH_INFO $path_info;
    }

    location / {
        if (!-f $request_filename){
             rewrite ^.*$ /index.php last;
        }
    }
}

apache 中url美化隐藏 index.php 文件

在根目录下创建 .htaccess 文件内容如下

Options +FollowSymlinks
IndexIgnore */*
RewriteEngine On

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

欢迎给位fork 本项目并积极提交bug,修改bug,让 YiiCms 越来越好。

Clone this wiki locally