23 Star 92 Fork 44

liufee / cms

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
WEBSERVER_CONFIG.md 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
liufee 提交于 2020-08-14 21:01 . fix:ajax response format

附:web服务器配置(注意是设置"path/to/frontend/web为根目录)

  • php内置web服务器(仅可用于开发环境,当您的环境中没有web服务器时)
 cd /path/to/cms
 php ./yii serve  
 
 #至此启动成功,可以通过localhost:8080/和localhost:8080/admin来访问了,在线安装即访问localhost:8080/install.php
  • Apache
 DocumentRoot "path/to/frontend/web"
 <Directory "path/to/frontend/web">
     # 开启 mod_rewrite 用于美化 URL 功能的支持(译注:对应 pretty URL 选项)
     RewriteEngine on
     # 如果请求的是真实存在的文件或目录,直接访问
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     # 如果请求的不是真实文件或目录,分发请求至 index.php
     RewriteRule . index.php
 
     # ...其它设置...
 </Directory>
  • Nginx
server {
    server_name  localhost;
    root   /path/to/frontend/web;
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
    
    location ~ /admin/(?!index.php|index-test.php|static|assets).*$ {
       rewrite /admin/(.*) /admin/index.php?r=$1 last;
    }
    
    location ~ /api/(?!index.php|index-test.php|static|assets).*$ {
       rewrite /api/(.*) /api/index.php?r=$1 last;
    }

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ .*\.(js|css|png|jpg|jpeg|gif)$ {
       try_files $uri =404;
    }

}
PHP
1
https://gitee.com/liufee/cms.git
git@gitee.com:liufee/cms.git
liufee
cms
cms
master

搜索帮助