简体   繁体   English

使用Apache在子文件夹的子域中运行JetBrains Hub

[英]Run JetBrains Hub in a subdomain in a subfolder with Apache

I am using JetBrains tools to manage a team. 我正在使用JetBrains工具来管理团队。 Using Apache to manage my domains/subdomains. 使用Apache管理我的域/子域。 I have a sub domain named dev.sepidarr.ir which is responsible as the main entry point of my development environment. 我有一个名为dev.sepidarr.ir的子域,它是我开发环境的主要入口点。

dev.sepidarr.ir.conf dev.sepidarr.ir.conf

<VirtualHost *:80>

  DocumentRoot /home/neacodin/domains/dev.sepidarr.ir/
  DirectoryIndex index.html

  <Directory "/home/neacodin/domains/dev.sepidarr.ir">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
  </Directory>

  ServerName dev.sepidarr.ir
  ServerAlias www.dev.sepidarr.ir

  RewriteEngine on
  RewriteCond %{SERVER_NAME} =www.dev.sepidarr.ir [OR]
  RewriteCond %{SERVER_NAME} =dev.sepidarr.ir
  RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

</VirtualHost>

I want to have each JetBrains' tools running in a different url, for example I need upsource to run as dev.sepidarr.ir/upsource and hub in dev.sepidarr.ir/hub . 我想有一个不同的URL运行的每个JetBrains公司的工具,比如我需要upsource为运行dev.sepidarr.ir/upsourcehubdev.sepidarr.ir/hub

Based on the official JetBrains tutorial about how to setup a reverse proxy server , I have created a .conf file for hub as follow. 基于有关如何设置反向代理服务器的官方JetBrains教程 ,我为hub创建了一个.conf文件,如下所示。

<VirtualHost *:80>

  ServerName dev.sepidarr.ir

  DefaultType none

  RewriteEngine on
  AllowEncodedSlashes on

  RewriteCond %{QUERY_STRING} transport=polling
  RewriteRule /(.*)$ http://localhost:8110/$1 [P]

  ProxyRequests off
  ProxyPreserveHost On

  ProxyPass /hub/ http://localhost:8110/hub
  ProxyPassReverse /hub/ http://localhost:8110/hub

</VirtualHost>

The problem is when I navigate to dev.sepidarr.ir it works fine. 问题是当我导航到dev.sepidarr.ir它工作正常。 But when I try to open dev.sepidarr.ir/hub I get 404 Not Found . 但是当我尝试打开dev.sepidarr.ir/hub我得到404 Not Found

I have also configured hub to run with a custom base-url with the following command. 我还使用以下命令将集线器配置为与自定义基本URL一起运行。

hub.sh configure--listen-port 8110 --base-url https://dev.sepidarr.ir/hub

But nothing changed. 但是什么都没有改变。

Simply use this: 只需使用以下命令:

<VirtualHost *:80>

ServerName dev.sepidarr.ir

... REST OF CONFIGS ...

<Location /hub>
    ProxyPass http://localhost:8110/hub
    ProxyPassReverse http://localhost:8110/hub
    Order allow,deny
    Allow from all
</Location>

</VirtualHost>

Now you can open dev.sepidarr.ir/hub and it shows {your_server_id/localhost}:8110/hub instead. 现在,您可以打开dev.sepidarr.ir/hub ,它显示为{your_server_id/localhost}:8110/hub

It's possible to add as much Location directive as you want. 可以根据需要添加任意多个Location指令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM