vuethink使用教程
我们的目录是网站根目录,用webpath表示,下面所有遇到webpath的地方都表示网站的站点所在根目录1 下载git clone https://github.com/honraytech/VueThink.git2 导入数据将webpath/VueThink/php/install.sql导入到你的数据库3 配置数据库链接修改webpath/VueThink/php/config/databa
·
我们的目录是网站根目录,用webpath表示,下面所有遇到webpath的地方都表示网站的站点所在根目录
1 下载
git clone https://github.com/honraytech/VueThink.git
2 导入数据
将webpath/VueThink/php/install.sql导入到你的数据库
3 配置数据库链接
修改webpath/VueThink/php/config/database.php,将数据库配置信息修改正确
4 创建runtime目录,并设置为可读写
mkdir webpath/VueThink/php/runtime
chmod 777 webpath/VueThink/php/runtime
4 修改main.js
在webpath/VueThink/frontEnd/src/main.js中搜索
axios.defaults.baseURL = HOST
修改为
axios.defaults.baseURL = 'http://localhost/VueThink/php/index.php/'
搜索
window.HOST = HOST
修改为
window.HOST = 'http://localhost/VueThink/php/index.php/'
5 安装依赖
cd webpath/VueThink/frontEnd/
npm install
6 运行开发
npm run dev
nginx配置
如果你用nginx可能需要配置跨域,server中添加以下配置,注意一定要根据自己服务器的情况修改,不要盲目复制粘贴
#add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin, DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept, authKey, sessionId';
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '$http_origin';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin, DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept, authKey, sessionId';
return 204;
}
index index.php;
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin, DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept, authKey, sessionId';
return 204;
}
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# With php-cgi (or other tcp sockets):
fastcgi_pass 127.0.0.1:9000;
}
更多推荐
已为社区贡献11条内容
所有评论(0)