要在PhpStorm中遠程連接到Ubuntu服務器,您可以使用SSH或FTP/SFTP協議。以下是詳細步驟:
File
Settings (Windows/Linux)或 PhpStorm Preferences
(macOS)。Build, Execution, Deployment
,點擊左上角的 +
按鈕添加新的部署配置,選擇 SSH
。Name
:自定義名稱。Host
:服務器IP地址。Port
:默認22。User name
:服務器用戶名。Auth type
:選擇 Key pair
(OpenSSH 或 PuTTY)。Private key file
:選擇私鑰文件路徑。Mappings
選項卡中,配置本地和遠程路徑映射。Apply
和 OK
保存配置。Test SSH Connection
確保信息正確無誤。Upload to Remote Host
,然后選擇之前配置好的遠程服務器即可。File
Settings (Windows/Linux)或 PhpStorm Preferences
(macOS)。Build, Execution, Deployment
,點擊左上角的 +
按鈕添加新的部署配置,選擇 FTP
或 SFTP
。Name
:自定義名稱。Type
:選擇 FTP
或 SFTP
。Host
:服務器IP地址。Port
:默認21(FTP)或22(SFTP)。User name
:服務器用戶名。Auth type
:選擇 Password
或 Key pair
(OpenSSH 或 PuTTY)。如果選擇 Key pair
,則需選擇私鑰文件路徑。Mappings
選項卡中,配置本地和遠程路徑映射。Apply
和 OK
保存配置。Test FTP/SFTP Connection
確保信息正確無誤。Upload to Remote Host
,然后選擇之前配置好的遠程服務器即可。通過以上步驟,您可以在PhpStorm中成功連接到Ubuntu服務器,并進行文件的上傳和下載。