nginx vue history模式 URL转发配置
#转发机制
location /{
index index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*) /index.html last;
break;
}
}
实现:https://h5.xxx.com/mobile/acticity/album?id=1
#转发机制
location /{
index index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.*) /index.html last;
break;
}
}
实现:https://h5.xxx.com/mobile/acticity/album?id=1
function get_init_field($table){
//$table=$this->request->param('model');
$dbname = Config::get('database.database');
$prefix = Config::get('database.prefix');
$sql="select COLUMN_NAME ,DATA_TYPE from information_schema.COLUMNS where TABLE_SCHEMA = ? and table_name = ? and DATA_TYPE = 'int'";
$columnList = Db::query($sql, [$dbname, $table]);
$fieldlist = [];
foreach ($columnList as $index => $item) {
$fieldlist[] = $item['COLUMN_NAME'];
}
return json($fieldlist);
}
$table 即为表名
$dbname 数据库名
$prefix 数据库前缀
select COLUMN_NAME ,DATA_TYPE from information_schema.COLUMNS where TABLE_SCHEMA ='washbox' and table_name = 'fa_user' and DATA_TYPE = 'int';


















在centos7.5主机部署了lnmp1.8环境
部署thinkphp5的程序时候,rewrite转发配置正常。但显示空白,经过多番研究,发现是fastcgi的安全目录open_Dir问题
/usr/local/nginx/conf
【fastcgi.conf】
大概在26-27行
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
#未改前
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
#修改后
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/../:/tmp/:/proc/";
OK 大功告成
解锁
chattr -i /站点目录/.user.ini
删除
rm -rf 站点目录
#转发机制
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
} 原因:镜像源出现问题
修改镜像源:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
更换成阿里云镜像云即可