vuethink使用教程

我们的目录是网站根目录,用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;
    }
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值