在根目录运行thinkphp的ngnix上绑定通过访问/#/可以看到的vue-cli
时间: 2023-12-08 11:05:54 浏览: 34
在nginx上配置根目录绑定thinkphp的方法是,在nginx的配置文件中设置root参数指向thinkphp的根目录,同时在location中设置访问路径为“/”,例如:
```
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html/thinkphp/;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
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;
}
}
```
这样配置后,当访问根目录时就会自动调用thinkphp的入口文件index.php进行处理。
相关问题
ngnix同时绑定thinphp和vue-cli,要求根目录绑定thinkphp
和vue-cli是可以实现的。以下是具体步骤:
1. 安装nginx和php,并配置好nginx的默认站点。
2. 在nginx的默认站点配置文件中,添加如下配置:
```
location / {
# Root directory for ThinkPHP
root /path/to/thinkphp/public/;
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
location /api {
# Proxy to Thin server
proxy_pass http://127.0.0.1:3000;
}
location /static {
# Root directory for Vue.js
root /path/to/vue-cli/dist/;
}
```
3. 启动Thin server,并将其监听在127.0.0.1:3000。
4. 将Vue.js项目打包后,将生成的静态文件放置于nginx的默认站点根目录下的static文件夹中。
5. 访问http://localhost/即可访问ThinkPHP项目,访问http://localhost/api即可访问Thin server提供的API,访问http://localhost/static即可访问Vue.js项目。
vue-admin-thinkphp
我可以回答这个问题。Vue-admin-thinkphp 是一个基于 Vue.js 和 ThinkPHP 框架开发的后台管理系统。它提供了丰富的组件和功能,可以帮助开发者快速搭建一个高效、易用的后台管理系统。