Plesk 和Plesk 擴展的某些方面可能無法通過 GUI、XML API或命令進行管理。但是卻受 panel.ini 設定檔的控制。例如,編輯該檔,您可以:

  • 禁止使用 『root』 或 『Administrator』 驗證憑據登入Plesk。
  • 隱藏在Plesk中註冊的 IP 地址,以令該位址不在介面中顯示,而無法將其分配給訂閱或代理商。
  • 為擴展目錄指定一個自訂的 URL 位址,等等。

可在此處找到 panel.ini 文件:

  • (Plesk for Linux) /usr/local/psa/admin/conf/panel.ini
  • (Plesk for Windows)  %plesk_dir%\admin\conf\panel.ini

如果該檔不在伺服器上,則可以在指定位址並以 panel.ini 為名創建一個空檔。您還可以將同一目錄中的 panel.ini.sample 檔重命名為 panel.ini 。這樣,檔將包含一系列您可以參考的預配置設定。

配置 panel.ini 中的設定

若要通過 panel.ini 檔配置設定,需要通過以下兩種當中的一種方式進行編輯:

  • 使用文字編輯器編輯 panel.ini 文件。
  • 安裝 Panel.ini Editor 擴展 並在 Plesk GUI 中編輯 panel.ini 文件。

不管您選擇哪個選項,要通過 panel.ini 檔配置一個或多個設定,都需要根據以下模式添加項到該檔:

[Section name]
Setting name = Value

備註: 如果某個設定接受布林 (『yes』 或 『no』) 值,則可以使用 『true』、』on』 或 『yes』 來啟用該設定,使用 『false』、』off』、』no’或 『none』 來禁用。

更改會在保存檔後立即生效。無需重啟任何服務。

例如,若要禁用 IP 地址禁止 (Fail2Ban),需添加以下行到 panel.ini 文件:

[fail2ban]
enabled = false

那麼, IP 地址禁止 (Fail2Ban) 將會從 安全 組(在 工具與設定 螢幕中)消失,那麼將無法通過CLI命令對其進行管理。

任何可以通過 panel.ini 檔進行配置的設定都隸屬預定義部分。若要自訂某項設定,必須將其放置 panel.ini 檔中所屬的部分。任何一個部分都不需要包括多次。如果您想要自訂隸屬某個部分的多個設定,需僅一次包括該部分,然後放置所有的設定。

例如,要自訂應用目錄的 URL位址和啟用應用目錄自訂,需添加以下行到 panel.ini 文件:

[aps]
catalogUrl = "http://example.com"
catalogsCustomization = on

若要通過 Panel.ini Editor 擴展配置設定,請進入 擴展 > 我的擴展 > Panel.ini Editor > 打開 進行配置。

image-79685.png

Here, on the 「Viewer」 tab, you can see the complete list of all settings that can be managed via the panel.ini file, broken down by section. The 「Setting」 column displays the machine-readable parameter name, the 「Value」 column displays its currently assigned value, and the 「Description」 column can show the description of a setting.

You can easily tell which settings were added to the panel.ini file: their values are shown in bold, and their default value is shown in parentheses after the currently assigned one.

For example, on the screenshot below, the setting catalogUrl was assigned the value http://example.com instead of the default one (http://cdn.apscatalog.plesk.com).

image-example

備註: Certain settings have no default values. For these settings, only the currently assigned value is displayed even if the settings were added to the panel.ini file.

To see only those settings that were added to the panel.ini file, click Modified. To return to the full list of settings, click All. You can also search for a specific setting using the search box.

To add settings to the panel.ini file via Panel.ini Editor:

  1. Go to Extensions > My Extensions > Panel.ini Editor > Open.
  2. Select one or more settings that you want to add to panel.ini and click Copy settings. You can select settings that belong to the same section or different sections.
  3. Go to the 「Editor」 tab and click Paste settings. Panel.ini Editor will paste the copied setting or settings.
  4. Click Save to save the current panel.ini configuration.

Descriptions of panel.ini Settings

Some settings in Panel.ini Editor have descriptions. When Panel.ini Editor is installed or updated, you receive the descriptions that were approved by the Plesk team. However, you can also fill in the missing descriptions or edit the existing ones yourself. You do it differently depending on your Plesk version.

備註: When Panel.ini Editor is updated, it preserves both new descriptions added by you and the changes you made to default descriptions.

備註: If you feel that other Plesk users can benefit from your descriptions, share them! Approved descriptions become available to other Panel.ini Editor users. Read how to share the descriptions.

(Plesk 18.0) To edit descriptions of settings in Panel.ini Editor:

  1. Go to Extensions > My Extensions > Panel.ini Editor > Open.
  2. Click the image-pencil_icon icon in the row of a setting which description you want to fill in or edit.
  3. Type the description and then click image-checkmark to save changes.

(Plesk 17.8 and earlier) To edit descriptions of settings in Panel.ini Editor:

  1. Open the following file:

    • (Plesk for Linux) /usr/local/psa/var/modules/panel-ini-editor/default-descriptions/en-US.json
    • (Plesk for Windows) %plesk_dir% \var\modules\panel-ini-editor\default-descriptions\en-US.json
  2. Add descriptions complying with the JSON file structure:

    {
      "section1": {
        "setting1": "description",
        "setting2": "description"
      },
      " section2": {
        "setting1": "description"
      }
    }
    

    For example, if you want to add a description for the file setting

    image-setting-example

    then the JSON entry will look like this:

    {
      "log": {
        "file": "description"
      }
    }
    
  3. Save changes made to the en-US.json file.

Editing panel.ini via Panel.ini Editor Using Presets

You can make switching between different configurations easier using presets. A preset is a configuration of panel.ini settings, which is created once and then can be loaded on demand without the necessity to manually add or remove settings.

To create a preset:

  1. Go to Extensions > My Extensions > Panel.ini Editor > Open.
  2. Go to the 「Editor」 tab and edit the panel.ini file to create the desired configuration.
  3. Click Add, give the preset a name, and then click Save.

The preset was created. You can now load the desired configuration of settings at any time by loading the preset.

To load a preset:

  1. Go to Extensions > My Extensions > Panel.ini Editor > Open.
  2. Go to the 「Editor」 tab.
  3. Click Load and select the desired preset.
  4. The 「Editor」 tab now shows the configuration of settings that were saved in the preset. Click Save to apply it to the panel.ini file.

Now the panel.ini file contains the chosen configuration of settings. You can delete unneeded presets by clicking Delete and selecting the preset that you want to delete.

恢復默認的設定

若要將通過 panel.ini 檔自訂的設定恢復為預設值,請打開要編輯的檔移除相應行,或在該行的開頭添加 『;』 字元將其注釋掉,如下:

[fail2ban]
; enabled = false

該設定會在保存檔後立即恢復為預設值。

若要將通過 panel.ini 檔自訂的所有設定恢復為其預設值,請進行以下操作:

  • 通過SSH 或 RDP登入伺服器移除或重命名 panel.ini 文件。
  • Open the Panel.ini Editor extension and click Reset to defaults.

參考

下面是可通過 panel.ini 檔實現的用戶自訂方案的示例。注意這個列表並不詳盡。某些 Plesk 擴展的操作可通過 panel.ini 檔進行自訂 - 請參考擴展的文檔瞭解詳情。