Skip to content

部署注意事项

本页为cms管理系统一些常见的配置和部署问题说明。

系统环境和配置要求

  • 系统windows、linux都可以,建议linux
  • PHP版本:5.6 ≤ PHP ≤ 7.3 (推荐7.3)
  • Mysql ≥ 5.6(推荐5.7)
  • IIS/Apache/Nginx(推荐Nginx)
  • PHP Fileinfo Extension
  • 宝塔面板需删除proc_open、passthru、putenv三个被禁用的PHP函数

访问目录指向public文件夹,bootstrap、public、storage三个文件夹需要755权限,并且开启伪静态配置。

Nginx伪静态

nginx
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Apache伪静态

如下.htaccess文件放于根目录

apache
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

虚拟主机

很多虚拟主机无法将根目录设置为public文件夹时的Apache伪静态

apache
<FilesMatch (.env) >
 order allow,deny
 deny from all
</FilesMatch>

<IfModule mod_rewrite.c>
    RewriteEngine on
    
    RewriteCond %{REQUEST_URI} !^/public/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/(upload|asset|theme)/
    RewriteRule ^(.*)$ /public/$1 [NC,L,QSA] 
    
    RewriteCond %{REQUEST_URI} !^/public/ 
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /public/index.php/$1 [NC,L,QSA]
    
</IfModule>

两种情况的.htaccess文件都已放在对应目录下,可直接使用。

IIS使用URL rewrite模块导入Apache的.htaccess文件转换成web.config文件使用即可。

阿里云虚拟主机需将config/app.php中的

php
'cipher' => 'AES-256-CBC',

改为

php
'cipher' => 'AES-128-CBC',

更改此配置后无法使用super帐户,无调试模式,页面出现错误请至storage/logs查看错误日志。

新增的一些功能

内置新闻和产品两个模型的api接口,分别是/news和/pro,前端用ajax或axios请求,可用参数有:

  • 栏目分类id:cate_id
  • 内容id:cid
  • 页码:page
  • 每页条数:per_page

产品模型中新增了图册和标签功能,默认开启

图册
blade
<cimg cid="$content['id']" row="5">
	<img src="{{ $_v['url'] }}" alt="{{ $_v['title'] }}">
</cimg>
标签

在内容管理的标签管理中添加标签,然后添加产品时选择标签即可

blade
// 详情页
@foreach ($content['tag'] as $tags)
	<tag id="$tags" row="1">
		<div class="tag">{{ $_v['title'] }}</div>
	</tag>
@endforeach

// 列表页
<content pagesize="10">
	<div>
    @foreach ($_v['tag'] as $tags)
	  <tag id="$tags" row="1">
		  <div class="tag">{{ $_v['title'] }}</div>
	  </tag>
	  @endforeach
  </div>
</content>