Create SSH connection
SSH is used to establish a connection with a remote server
Settings -> Tools -> SSH Configurations
Add a new ssh connection, Host is the ip address, Username is the username, and the authentication method is password verification
After filling in everything, you can click Test Connection to test whether the connection is successful
CreateDeployment
Deployment is used to build path mapping between local and remote servers
Settings -> Build,Execution,Deployment -> Deployment
Add a new Deployment, select SFTP for Type, and select the SSH connection just configured for SSH. The root directory and URL are as shown in the figure. As shown
select Mappings to set path mapping. Local path is the local directory of the project, and Deployed path is the directory on the remote server
Upload local files to the server< /span>
Set the file to be uploaded to the server every time it is saved, and the server file will be deleted simultaneously when the local file is deleted
Compile using server environment
Sometimes our local environment is inconsistent with the server, causing the project to fail to run locally. After configuring the above steps, it can be modified to compile on the server.
In Run/Debug Configurations, set Run on to the server for ssh connection and check Build on remote target.