将端口号8787改为7979
This commit is contained in:
@@ -161,7 +161,7 @@ php webman migrate
|
|||||||
|
|
||||||
**开发环境需同时启动后端与前端:**
|
**开发环境需同时启动后端与前端:**
|
||||||
|
|
||||||
1. **启动后端(API 服务,端口 8787):**
|
1. **启动后端(API 服务,端口 7979):**
|
||||||
|
|
||||||
**Linux / Mac:**
|
**Linux / Mac:**
|
||||||
```bash
|
```bash
|
||||||
@@ -184,11 +184,11 @@ php webman migrate
|
|||||||
- 前台地址:http://localhost:1818/index.html/#/
|
- 前台地址:http://localhost:1818/index.html/#/
|
||||||
- 后台地址:http://localhost:1818/index.html/#/admin
|
- 后台地址:http://localhost:1818/index.html/#/admin
|
||||||
|
|
||||||
> 注意:前端通过 Vite 代理将 `/api`、`/admin`、`/install` 转发到后端 8787 端口,请勿直接访问 8787 端口的前端页面,否则可能出现 404。
|
> 注意:前端通过 Vite 代理将 `/api`、`/admin`、`/install` 转发到后端 7979 端口,请勿直接访问 8787 端口的前端页面,否则可能出现 404。
|
||||||
|
|
||||||
### 5.6 生产环境 Nginx(反向代理 Webman)
|
### 5.6 生产环境 Nginx(反向代理 Webman)
|
||||||
|
|
||||||
部署到服务器时,若使用 **Nginx** 作为站点入口,需将请求转发到本机 **Webman** 进程(默认监听端口与 `config/process.php` 中 `listen` 一致,一般为 `8787`,反代目标使用 `127.0.0.1:8787`)。
|
部署到服务器时,若使用 **Nginx** 作为站点入口,需将请求转发到本机 **Webman** 进程(默认监听端口与 `config/process.php` 中 `listen` 一致,一般为 `7979`,反代目标使用 `127.0.0.1:8787`)。
|
||||||
|
|
||||||
在站点 **`server { }`** 块中可增加如下写法:**先由 Nginx 根据 `root` 判断是否存在对应静态文件;不存在则转发到 Webman**(`root` 建议指向项目 `public` 目录)。
|
在站点 **`server { }`** 块中可增加如下写法:**先由 Nginx 根据 `root` 判断是否存在对应静态文件;不存在则转发到 Webman**(`root` 建议指向项目 `public` 目录)。
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ location ^~ / {
|
|||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Connection "";
|
proxy_set_header Connection "";
|
||||||
if (!-f $request_filename) {
|
if (!-f $request_filename) {
|
||||||
proxy_pass http://127.0.0.1:8787;
|
proxy_pass http://127.0.0.1:7979;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -663,14 +663,14 @@ class Install extends Api
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取安装完成后的访问地址(根据请求来源区分 API 与前端开发模式)
|
* 获取安装完成后的访问地址(根据请求来源区分 API 与前端开发模式)
|
||||||
* - 通过 API 访问(8787):index#/admin、index#/(无 index 与 # 之间的斜杠)
|
* - 通过 API 访问(7979):index#/admin、index#/(无 index 与 # 之间的斜杠)
|
||||||
* - 通过前端开发服务访问(1818):/#/admin、/#/
|
* - 通过前端开发服务访问(1818):/#/admin、/#/
|
||||||
*/
|
*/
|
||||||
public function accessUrls(Request $request): Response
|
public function accessUrls(Request $request): Response
|
||||||
{
|
{
|
||||||
$this->setRequest($request);
|
$this->setRequest($request);
|
||||||
$host = $request->header('host', '127.0.0.1:8787');
|
$host = $request->header('host', '127.0.0.1:7979');
|
||||||
$port = '8787';
|
$port = '7979';
|
||||||
if (str_contains($host, ':')) {
|
if (str_contains($host, ':')) {
|
||||||
$port = substr($host, strrpos($host, ':') + 1);
|
$port = substr($host, strrpos($host, ':') + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ return [
|
|||||||
'api' => 'http://0.0.0.0:3232',
|
'api' => 'http://0.0.0.0:3232',
|
||||||
'app_key' => '6d0af5971ad191f2dc8a500885cb79c7',
|
'app_key' => '6d0af5971ad191f2dc8a500885cb79c7',
|
||||||
'app_secret' => 'c457f0be89cd48d481b37f16c0a97f5f',
|
'app_secret' => 'c457f0be89cd48d481b37f16c0a97f5f',
|
||||||
'channel_hook' => 'http://127.0.0.1:8787/plugin/webman/push/hook',
|
'channel_hook' => 'http://127.0.0.1:7979/plugin/webman/push/hook',
|
||||||
'auth' => '/plugin/webman/push/auth'
|
'auth' => '/plugin/webman/push/auth'
|
||||||
];
|
];
|
||||||
@@ -21,7 +21,7 @@ global $argv;
|
|||||||
return [
|
return [
|
||||||
'webman' => [
|
'webman' => [
|
||||||
'handler' => Http::class,
|
'handler' => Http::class,
|
||||||
'listen' => 'http://0.0.0.0:8787',
|
'listen' => 'http://0.0.0.0:7979',
|
||||||
'count' => cpu_count() * 4,
|
'count' => cpu_count() * 4,
|
||||||
'user' => '',
|
'user' => '',
|
||||||
'group' => '',
|
'group' => '',
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -7,5 +7,5 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- "./:/app"
|
- "./:/app"
|
||||||
ports:
|
ports:
|
||||||
- "8787:8787"
|
- "7979:7979"
|
||||||
command: ["php", "start.php", "start" ]
|
command: ["php", "start.php", "start" ]
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
# 将 server_name 和 root 改为实际值后,放入 nginx 的 conf.d 或 sites-available
|
# 将 server_name 和 root 改为实际值后,放入 nginx 的 conf.d 或 sites-available
|
||||||
|
|
||||||
upstream webman {
|
upstream webman {
|
||||||
server 127.0.0.1:8787;
|
server 127.0.0.1:7979;
|
||||||
keepalive 10240;
|
keepalive 10240;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ ENV = 'development'
|
|||||||
# base路径
|
# base路径
|
||||||
VITE_BASE_PATH = './'
|
VITE_BASE_PATH = './'
|
||||||
|
|
||||||
# 本地环境接口地址 - 用空字符串走同源,由 vite 代理到 8787,避免 CORS
|
# 本地环境接口地址 - 用空字符串走同源,由 vite 代理到 7979,避免 CORS
|
||||||
VITE_AXIOS_BASE_URL = ''
|
VITE_AXIOS_BASE_URL = ''
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ const viteConfig = ({ mode }: ConfigEnv): UserConfig => {
|
|||||||
open: VITE_OPEN != 'false',
|
open: VITE_OPEN != 'false',
|
||||||
// 开发时把 /api、/admin、/install 代理到 webman,避免跨域
|
// 开发时把 /api、/admin、/install 代理到 webman,避免跨域
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': { target: 'http://localhost:8787', changeOrigin: true },
|
'/api': { target: 'http://localhost:7979', changeOrigin: true },
|
||||||
'/admin': { target: 'http://localhost:8787', changeOrigin: true },
|
'/admin': { target: 'http://localhost:7979', changeOrigin: true },
|
||||||
'/install': { target: 'http://localhost:8787', changeOrigin: true },
|
'/install': { target: 'http://localhost:7979', changeOrigin: true },
|
||||||
'/plugin': { target: 'http://localhost:8787', changeOrigin: true },
|
'/plugin': { target: 'http://localhost:7979', changeOrigin: true },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
|||||||
Reference in New Issue
Block a user