IntelliJ IDEA 2021.2 Help

Create an in-place server configuration创建就地服务器配置

In the in-place server configuration, the web server is running on your computer, your project is under its document root (for example, in the /htdocs folder), and you do your development directly on the server.在就地服务器配置中,web服务器在您的计算机上运行,项目位于其文档根目录下(例如,在/htdocs文件夹中),您直接在服务器上进行开发。

The document root of an in-place server is the parent of the project root, either immediate or not. 就地服务器文档根目录是项目根目录的父目录,可以是立即的,也可以不是。The document root is the web root or website root directory. Usually, it is the publicly-accessible base folder for a website.文档根目录是web根目录或网站根目录。通常,它是网站的公共可访问基本文件夹。

To configure access to the server in this set-up, you only need to specify the URL address of the server document root, appoint the project root folder, and specify the URL address to access it.要在此设置中配置对服务器的访问,您只需指定服务器文档根的URL地址,指定项目根文件夹,并指定访问它的URL地址。

Specify the name, type, and visibility of a server configuration指定服务器配置的名称、类型和可见性

  1. Open the Deployment page by doing one of the following:通过执行以下操作之一打开部署页面:

    • In the Settings/Preferences dialog Ctrl+Alt+S, go to Build, Execution, Deployment | Deployment.在“设置/首选项”对话框Ctrl+Alt+S中,进入“构建、执行、部署”|“部署”。

    • From the main menu, select Tools | Deployment | Configuration.从主菜单中,选择“工具”|“部署”|“配置”。

  2. In the left-hand pane that lists all the existing server configurations, click Add Add item and select In-place from the list.在列出所有现有服务器配置的左侧窗格中,单击“添加”Add item,然后从列表中选择“就地”。

  3. In the Create new server dialog that opens, type the name of the server to be created and click OK. 在打开的“创建新服务器”对话框中,键入要创建的服务器的名称,然后单击“确定”。The Create new server dialog closes and you return to the Connection tab of the Deployment node.创建新服务器”对话框关闭,您将返回到部署节点的“连接”选项卡。

  4. Click the Use as Default the Use as default button to have IntelliJ IDEA silently apply the current configuration in the following cases:在以下情况下,单击“作为默认值使用”the Use as default button,让IntelliJ IDEA以静默方式应用当前配置:

  5. Use the Visible only for this project checkbox to configure the visibility of the server access configuration.使用“仅此项目可见”复选框配置服务器访问配置的可见性。

    • Select the checkbox to restrict the use of the configuration to the current project. 选中该复选框可将配置的使用限制为当前项目。Such configuration cannot be reused outside the current project. 此类配置不能在当前项目之外重用。It does not appear in the list of available configurations in other projects.它不会出现在其他项目的可用配置列表中。

      The server records are stored in the .idea directory together with the project, which allows sharing them between team members through a VCS.服务器记录与项目一起存储在.idea目录中,允许团队成员通过VCS共享这些记录。

      In the server access configurations list in the left-hand pane, the configurations visible only in the current project are marked with the Visible only in current project icon icon.在左侧窗格的服务器访问配置列表中,仅在当前项目中可见的配置用Visible only in current project icon图标标记。

    • When the checkbox is cleared, the configuration is visible in all IntelliJ IDEA projects. 清除复选框后,配置在所有IntelliJ IDEA项目中可见。Its settings can be reused across several projects.它的设置可以跨多个项目重用。

Specify the URL address of the server document root指定服务器文档根目录的URL地址

  1. Open the Deployment page by doing one of the following:通过执行以下操作之一打开部署页面:

    • In the Settings/Preferences dialog Ctrl+Alt+S, go to Build, Execution, Deployment | Deployment.在“设置/首选项”对话框Ctrl+Alt+S中,进入“构建、执行、部署”|“部署”。

    • From the main menu, select Tools | Deployment | Configuration.从主菜单中,选择“工具”|“部署”|“配置”。

  2. In the Web server URL field, type the URL address associated with the document root of your Web server as defined in the Web server configuration file. Web服务器URL字段中,键入与Web服务器配置文件中定义的Web服务器文档根相关联的URL地址。This URL address will be the starting point for building the URL address of your application.此URL地址将是构建应用程序URL地址的起点。

    Both the HTTP and the HTTPS protocols are supported.HTTPHTTPS协议都受支持。

For example, the default document root is set to the htdocs folder, and the default URL address to access the data in it is http://localhost. 例如,默认文档根被设置为htdocs文件夹,访问其中数据的默认URL地址为http://localhostIf you have changed the default port 80, you have to specify the port explicitly: http://localhost:<port>.如果更改了默认端口80,则必须明确指定端口:http://localhost:<port>

Specify the project root folder and the URL address to access it指定项目根文件夹和访问它的URL地址

  1. Open the Deployment page by doing one of the following:通过执行以下操作之一打开部署页面:

    • In the Settings/Preferences dialog Ctrl+Alt+S, go to Build, Execution, Deployment | Deployment.在“设置/首选项”对话框Ctrl+Alt+S中,进入“构建、执行、部署”|“部署”。

    • From the main menu, select Tools | Deployment | Configuration.从主菜单中,选择“工具|部署|配置”。

  2. Click the Mappings tab.单击映射选项卡。

  3. In the Local path field, specify the full path to your project root folder. 在“本地路径”字段中,指定项目根文件夹的完整路径。Type the path manually, or click Browse button and choose the folder in the dialog, that opens.手动键入路径,或单击Browse button并在打开的对话框中选择文件夹。

  4. In the Web path field, type the path to the project root folder relative to the server document root specified in the server configuration file.在“Web路径”字段中,键入相对于服务器配置文件中指定的服务器文档根目录的项目根文件夹路径。

Last modified: 21 July 2021