1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

feat: 网站反向代理增加协议选择 (#1832)

This commit is contained in:
zhengkunwang 2023-08-04 17:42:09 +08:00 committed by GitHub
parent 80e845f320
commit aa1e548ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 10 deletions

View File

@ -107,8 +107,10 @@ func (f *FileInfo) search(search string, count int) (files []FileSearchInfo, tot
if err = cmd.Start(); err != nil {
return
}
defer cmd.Wait()
defer cmd.Process.Kill()
defer func() {
_ = cmd.Wait()
_ = cmd.Process.Kill()
}()
scanner := bufio.NewScanner(output)
for scanner.Scan() {

View File

@ -1314,7 +1314,7 @@ const message = {
value: 'value',
enable: 'Enable',
proxyAddress: 'Proxy Address',
proxyHelper: 'Example: http://127.0.0.1:8080',
proxyHelper: 'Example: 127.0.0.1:8080',
forceDelete: 'Force Delete',
forceDeleteHelper:
'Forced deletion will ignore errors generated during the deletion process and eventually delete metadata',
@ -1471,6 +1471,7 @@ const message = {
'Switching the PHP version will delete the original PHP container (the website code that has been mounted will not be lost), continue? ',
changeVersion: 'Switch version',
retainConfig: 'Whether to keep php-fpm.conf and php.ini files',
runDirHelper2: 'Please ensure that the secondary running directory is under the index directory',
},
php: {
short_open_tag: 'Short tag support',
@ -1489,6 +1490,8 @@ const message = {
disableFunction: 'Disable function',
disableFunctionHelper: 'Enter the function to be disabled, such as exec, please use multiple, split',
uploadMaxSize: 'Upload limit',
indexHelper:
'In order to ensure the normal operation of the PHP website, please place the code in the index directory and avoid renaming',
},
nginx: {
serverNamesHashBucketSizeHelper: 'The hash table size of the server name',

View File

@ -1257,7 +1257,7 @@ const message = {
value: '值',
enable: '開啟',
proxyAddress: '代理地址',
proxyHelper: ': http://127.0.0.1:8080',
proxyHelper: ': 127.0.0.1:8080',
forceDelete: '強製刪除',
forceDeleteHelper: '強製刪除會忽略刪除過程中產生的錯誤並最終刪除元數據',
deleteAppHelper: '同時刪除關聯應用數據庫以及應用備份',
@ -1404,6 +1404,7 @@ const message = {
changePHPVersionWarn: '切換 PHP 版本會刪除原有的 PHP 容器不會丟失已經掛載的網站代碼是否繼續 ',
changeVersion: '切換版本',
retainConfig: '是否保留 php-fpm.conf php.ini 文件',
runDirHelper2: '請確保二級運行目錄位於 index 目錄下',
},
php: {
short_open_tag: '短標簽支持',
@ -1422,6 +1423,7 @@ const message = {
disableFunction: '禁用函數',
disableFunctionHelper: '輸入要禁用的函數例如exec多個請用,分割',
uploadMaxSize: '上傳限製',
indexHelper: '為保障PHP網站正常運行請將代碼放置於 index 目錄並避免重命名',
},
nginx: {
serverNamesHashBucketSizeHelper: '服務器名字的hash表大小',

View File

@ -1257,7 +1257,7 @@ const message = {
value: '值',
enable: '开启',
proxyAddress: '代理地址',
proxyHelper: ': http://127.0.0.1:8080',
proxyHelper: ': 127.0.0.1:8080',
forceDelete: '强制删除',
forceDeleteHelper: '强制删除会忽略删除过程中产生的错误并最终删除元数据',
deleteAppHelper: '同时删除关联应用数据库以及应用备份',
@ -1281,7 +1281,7 @@ const message = {
primaryPath: '主目录',
folderTitle: '网站主目录主要包含四个文件夹',
wafFolder: '防火墙规则',
indexFolder: '网站root目录',
indexFolder: '网站 root 目录PHP 运行环境 静态网站代码存放目录',
logFolder: '网站日志',
sslFolder: '网站证书',
enableOrNot: '是否启用',
@ -1404,6 +1404,7 @@ const message = {
changePHPVersionWarn: '切换 PHP 版本会删除原有的 PHP 容器不会丢失已经挂载的网站代码是否继续',
changeVersion: '切换版本',
retainConfig: '是否保留 php-fpm.conf php.ini 文件',
runDirHelper2: '请确保二级运行目录位于 index 目录下',
},
php: {
short_open_tag: '短标签支持',
@ -1422,6 +1423,7 @@ const message = {
disableFunction: '禁用函数',
disableFunctionHelper: '输入要禁用的函数例如exec多个请用,分割',
uploadMaxSize: '上传限制',
indexHelper: '为保障 PHP 网站正常运行请将代码放置于 index 目录并避免重命名',
},
nginx: {
serverNamesHashBucketSizeHelper: '服务器名字的hash表大小',

View File

@ -347,3 +347,7 @@ html {
.left-button {
margin-left: 10px;
}
.pre-select {
width: 85px !important;
}

View File

@ -30,6 +30,9 @@
{{ $t('nginx.saveAndReload') }}
</el-button>
</el-space>
<span class="input-help">
{{ $t('website.runDirHelper2') }}
</span>
</el-form-item>
<el-form-item v-if="configDir" :label="$t('website.userGroup')">
<el-space wrap>
@ -49,6 +52,7 @@
<template #default>
<span class="warnHelper">{{ $t('website.runDirHelper') }}</span>
<span class="warnHelper">{{ $t('website.runUserHelper') }}</span>
<span class="warnHelper">{{ $t('php.indexHelper') }}</span>
</template>
</el-alert>
<br />

View File

@ -223,7 +223,7 @@
<el-select
v-model="website.appinstall.memoryUnit"
placeholder="Select"
style="width: 85px"
class="pre-select"
>
<el-option label="KB" value="K" />
<el-option label="MB" value="M" />
@ -268,8 +268,20 @@
</span>
</div>
</el-form-item>
<el-form-item v-if="website.type === 'proxy'" :label="$t('website.proxyAddress')" prop="proxy">
<el-input v-model="website.proxy" :placeholder="$t('website.proxyHelper')"></el-input>
<el-form-item
v-if="website.type === 'proxy'"
:label="$t('website.proxyAddress')"
prop="proxyAddress"
>
<el-input v-model="website.proxyAddress" :placeholder="$t('website.proxyHelper')">
<template #prepend>
<el-select v-model="website.proxyProtocol" class="pre-select">
<el-option label="http" value="http://" />
<el-option label="https" value="https://" />
<el-option :label="$t('website.other')" value="" />
</el-select>
</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('website.remark')" prop="remark">
<el-input v-model="website.remark"></el-input>
@ -348,6 +360,8 @@ const website = ref({
IPV6: false,
proxyType: 'tcp',
port: 9000,
proxyProtocol: 'http://',
proxyAddress: '',
});
const rules = ref<any>({
primaryDomain: [Rules.domain],
@ -356,7 +370,7 @@ const rules = ref<any>({
webSiteGroupId: [Rules.requiredSelectBusiness],
appInstallId: [Rules.requiredSelectBusiness],
appType: [Rules.requiredInput],
proxy: [Rules.requiredInput],
proxyAddress: [Rules.requiredInput],
runtimeID: [Rules.requiredSelectBusiness],
appinstall: {
name: [Rules.appName],
@ -549,6 +563,10 @@ const submit = async (formEl: FormInstance | undefined) => {
loading.value = false;
preCheckRef.value.acceptParams({ items: res.data });
} else {
if (website.value.type === 'proxy') {
website.value.proxy = website.value.proxyProtocol + website.value.proxyAddress;
console.log(website.value.proxy);
}
CreateWebsite(website.value)
.then(() => {
MsgSuccess(i18n.global.t('commons.msg.createSuccess'));