使用Apache

时间:2017-07-18 17:09:07

标签: apache jetbrains-ide jetbrains-hub

我正在使用JetBrains工具来管理团队。使用Apache管理我的域/子域。我有一个名为dev.sepidarr.ir的子域,它负责我的开发环境的主要入口点。

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>

我希望每个JetBrains&#39;工具在不同的网址中运行,例如我需要upsourcedev.sepidarr.ir/upsource中以hubdev.sepidarr.ir/hub运行。

根据官方JetBrains tutorial about how to setup a reverse proxy server,我为.conf创建了一个hub文件,如下所示。

<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>

问题是当我导航到dev.sepidarr.ir时它工作正常。但是当我尝试打开dev.sepidarr.ir/hub时,我会404 Not Found

我还使用以下命令将集线器配置为使用自定义base-url运行。

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

但没有改变。

1 个答案:

答案 0 :(得分:2)

只需使用:

<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>

现在您可以打开dev.sepidarr.ir/hub,然后显示{your_server_id/localhost}:8110/hub

可以根据需要添加尽可能多的Location指令。