Apache2

安装 Apache2。

sudo apt update
sudo apt install apache2=2.4.29-1ubuntu4.16

在以下路径中创建 ***.conf。

cd /etc/apache2/sites-available/
sudo vi acacia.conf

文件内容如下:

<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyRequests Off
  ErrorLog ${APACHE_LOG_DIR}/hoge_error.log
  <Location /scenario_modeler>
    ProxyPass http://localhost:8080/scenario_modeler
    ProxyPassReverse http://localhost:8080/scenario_modeler
  </Location>
  <Location /rdf_viewer>
    ProxyPass http://localhost:8080/rdf_viewer
    ProxyPassReverse http://localhost:8080/rdf_viewer
  </Location>
  <Location /scenario_editor>
    ProxyPass http://localhost:5000/scenario_editor
    ProxyPassReverse http://localhost:5000/scenario_editor
  </Location>
  <Location /airflow>
    ProxyPass http://localhost:8085/airflow
    ProxyPassReverse http://localhost:8085/airflow
  </Location>
  <Location /chronograf>
    ProxyPass http://localhost:8888/chronograf
    ProxyPassReverse http://localhost:8888/chronograf
  </Location>
  <Location /road_editor>
    ProxyPass http://localhost:38001/road_editor
    ProxyPassReverse http://localhost:38001/road_editor
  </Location>
  <Location /portal>
    ProxyPass http://localhost:3000/portal
    ProxyPassReverse http://localhost:3000/portal
  </Location>
</VirtualHost>

用 a2dissite 命令使 000-default.conf 失效。

sudo a2dissite 000-default

用 a2enmod 使 proxy 模块生效。

sudo a2enmod proxy_http

用 a2ensite 命令使 acacia.conf 生效。

sudo a2ensite acacia

重启 Apache,使配置生效。

sudo systemctl restart apache2