diff --git a/agent/app/service/website.go b/agent/app/service/website.go index ca4337f33..2f8465dc7 100644 --- a/agent/app/service/website.go +++ b/agent/app/service/website.go @@ -395,8 +395,12 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error) } website.Proxy = proxy } - case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo: - website.Proxy = fmt.Sprintf("127.0.0.1:%s", runtime.Port) + case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet: + proxyPort := runtime.Port + if create.Port > 0 { + proxyPort = strconv.Itoa(create.Port) + } + website.Proxy = fmt.Sprintf("127.0.0.1:%s", proxyPort) } case constant.Subsite: parentWebsite, err := websiteRepo.GetFirst(repo.WithByID(create.ParentWebsiteID)) @@ -450,7 +454,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error) } deleteWebsite := func(t *task.Task) { - _ = deleteWebsiteFolder(nginxInstall, website) + _ = deleteWebsiteFolder(website) } createTask.AddSubTask(i18n.GetMsgByKey("ConfigOpenresty"), configNginx, deleteWebsite) diff --git a/agent/app/service/website_utils.go b/agent/app/service/website_utils.go index d9c6ad82a..1fafb5c51 100644 --- a/agent/app/service/website_utils.go +++ b/agent/app/service/website_utils.go @@ -225,9 +225,8 @@ func configDefaultNginx(website *model.Website, domains []model.WebsiteDomain, a server.UpdateRoot(rootIndex) server.UpdatePHPProxy([]string{website.Proxy}, "") } - case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo: - proxy := fmt.Sprintf("http://127.0.0.1:%d", runtime.Port) - server.UpdateRootProxy([]string{proxy}) + case constant.RuntimeNode, constant.RuntimeJava, constant.RuntimeGo, constant.RuntimePython, constant.RuntimeDotNet: + server.UpdateRootProxy([]string{fmt.Sprintf("http://%s", website.Proxy)}) } case constant.Subsite: parentWebsite, err := websiteRepo.GetFirst(repo.WithByID(website.ParentWebsiteID)) @@ -760,14 +759,13 @@ func toMapStr(m map[string]interface{}) map[string]string { return ret } -func deleteWebsiteFolder(nginxInstall model.AppInstall, website *model.Website) error { - nginxFolder := path.Join(global.Dir.AppInstallDir, constant.AppOpenresty, nginxInstall.Name) - siteFolder := path.Join(nginxFolder, "www", "sites", website.Alias) +func deleteWebsiteFolder(website *model.Website) error { + siteFolder := GetSitePath(*website, SiteDir) fileOp := files.NewFileOp() if fileOp.Stat(siteFolder) { _ = fileOp.DeleteDir(siteFolder) } - nginxFilePath := path.Join(nginxFolder, "conf", "conf.d", website.PrimaryDomain+".conf") + nginxFilePath := GetSitePath(*website, SiteConf) if fileOp.Stat(nginxFilePath) { _ = fileOp.DeleteFile(nginxFilePath) } diff --git a/frontend/src/api/interface/runtime.ts b/frontend/src/api/interface/runtime.ts index 4eeb91ab1..f86c4c072 100644 --- a/frontend/src/api/interface/runtime.ts +++ b/frontend/src/api/interface/runtime.ts @@ -14,7 +14,7 @@ export namespace Runtime { version: string; status: string; codeDir: string; - port: number; + port: string; appID: number; } diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 686f5504d..28bc73944 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -2294,6 +2294,8 @@ const message = { changeDatabaseHelper2: 'Switching to another database will cause previous backups to be unrecoverable.', saveCustom: 'Save as Template', rainyun: 'Rain Yun', + volcengine: 'Volcengine', + runtimePortHelper: 'The current runtime environment has multiple ports. Please select a proxy port.', }, php: { short_open_tag: 'Short tag support', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index 0f0f89c52..b7172ea60 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -1883,7 +1883,6 @@ const message = { SSLList: '証明書リスト', createDnsAccount: 'DNSアカウント', aliyun: 'エイリアン', - volcengine: 'volcengine', manual: '手動解析', key: '鍵', check: 'ビュー', @@ -2156,6 +2155,8 @@ const message = { changeDatabaseHelper2: '別のデータベースに切り替えると、以前のバックアップが復元できなくなる可能性があります。', saveCustom: 'テンプレートとして保存', rainyun: '雨雲', + volcengine: 'volcengine', + runtimePortHelper: '現在の実行環境には複数のポートがあります。プロキシポートを選択してください。', }, php: { short_open_tag: '短いタグサポート', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 374768b6f..da01be0ca 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -1850,7 +1850,6 @@ const message = { SSLList: '인증서 목록', createDnsAccount: 'DNS 계정 생성', aliyun: '알리윤', - volcengine: '볼크엔진', manual: '수동 설정', key: '키', check: '보기', @@ -2119,6 +2118,8 @@ const message = { changeDatabaseHelper2: '다른 데이터베이스로 전환하면 이전 백업을 복원할 수 없게 될 수 있습니다.', saveCustom: '템플릿으로 저장', rainyun: 'Rainyun', + volcengine: 'volcengine', + runtimePortHelper: '현재 실행 환경에 여러 포트가 있습니다. 프록시 포트를 선택하세요.', }, php: { short_open_tag: '짧은 태그 지원', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index d1d67e7e9..1d0af43a9 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -1933,7 +1933,6 @@ const message = { SSLList: 'Senarai Sijil', createDnsAccount: 'Akaun DNS', aliyun: 'Aliyun', - volcengine: 'Volcengine', manual: 'Penyelesaian Manual', key: 'Kunci', check: 'Lihat', @@ -2208,6 +2207,8 @@ const message = { 'Menukar ke pangkalan data lain mungkin menyebabkan sandaran sebelumnya tidak dapat dipulihkan.', saveCustom: 'Simpan sebagai Templat', rainyun: 'Rainyun', + volcengine: 'Volcengine', + runtimePortHelper: 'Persekitaran runtime semasa mempunyai beberapa port. Sila pilih port proksi.', }, php: { short_open_tag: 'Sokongan tag pendek', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index ba3b2c8db..af9f63ad4 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -1926,7 +1926,6 @@ const message = { SSLList: 'Lista de certificados', createDnsAccount: 'Conta DNS', aliyun: 'Aliyun', - volcengine: 'Volcengine', manual: 'Análise manual', key: 'Chave', check: 'Ver', @@ -2204,6 +2203,8 @@ const message = { changeDatabaseHelper2: 'Alternar para outro banco de dados pode tornar backups anteriores irrecuperáveis.', saveCustom: 'Salvar como Modelo', rainyun: 'Rainyun', + volcengine: 'Volcengine', + runtimePortHelper: 'O ambiente de runtime atual possui várias portas. Por favor, selecione uma porta de proxy.', }, php: { short_open_tag: 'Suporte para short tags', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 4f8e3ed7b..900e4f196 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -1925,7 +1925,6 @@ const message = { SSLList: 'Список сертификатов', createDnsAccount: 'DNS аккаунт', aliyun: 'Aliyun', - volcengine: 'Volcengine', manual: 'Ручная настройка', key: 'Ключ', check: 'Просмотр', @@ -2204,6 +2203,8 @@ const message = { 'Переключение на другую базу данных может сделать предыдущие резервные копии невосстановимыми.', saveCustom: 'Сохранить как Шаблон', rainyun: 'Rainyun', + volcengine: 'Volcengine', + runtimePortHelper: 'O ambiente de runtime atual possui várias portas. Por favor, selecione uma porta de proxy.', }, php: { short_open_tag: 'Поддержка коротких тегов', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 20fa784e3..961f5791f 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -2132,6 +2132,8 @@ const message = { changeDatabaseHelper2: '切換其他資料庫會導致以前的備份無法恢復。', saveCustom: '另存为模版', rainyun: '雨雲', + volcengine: 'Volcengine', + runtimePortHelper: '當前運行環境存在多個端口,請選擇一個代理端口。', }, php: { short_open_tag: '短標簽支持', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 41da88e8c..db6805bdc 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -2114,6 +2114,7 @@ const message = { saveCustom: '另存为模版', rainyun: '雨云', volcengine: '火山引擎', + runtimePortHelper: '当前运行环境存在多个端口,请选择一个代理端口', }, php: { short_open_tag: '短标签支持', diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts index a5f858b79..46b5cb28d 100644 --- a/frontend/src/utils/util.ts +++ b/frontend/src/utils/util.ts @@ -685,3 +685,13 @@ export const escapeProxyURL = (url: string): string => { return url.replace(/[\/:?#[\]@!$&'()*+,;=%~]/g, (match) => encodeMap[match] || match); }; + +export function getRuntimeLabel(type: string) { + if (type == 'appstore') { + return i18n.global.t('menu.apps'); + } + if (type == 'local') { + return i18n.global.t('commons.table.local'); + } + return ''; +} diff --git a/frontend/src/views/website/website/create/index.vue b/frontend/src/views/website/website/create/index.vue index 7b4ed137a..c9dbed705 100644 --- a/frontend/src/views/website/website/create/index.vue +++ b/frontend/src/views/website/website/create/index.vue @@ -208,7 +208,7 @@ @@ -218,7 +218,7 @@ - {{ ' [' + $t('runtime.' + run.resource) + ']' }} + {{ ' [' + getRuntimeLabel(run.resource) + ']' }} @@ -237,6 +237,21 @@ + + + + + {{ $t('website.runtimePortHelper') }} + @@ -495,12 +510,10 @@ @@ -514,7 +527,7 @@