大网数据广告活动
服务器运维问答

Running two web applications on Apache 2.4

· 52CE 我爱测

I am trying to run two applications on my Linux apache server: OpenProject pgAdmin (which is WSGI application) And, in order to connect them from remote computer, I use those httpd configuration files: For OpenProject: Include /e…

问题原文

原帖链接 · Michał Turczyn · CC BY-SA 4.0

I am trying to run two applications on my Linux apache server:

  • OpenProject
  • pgAdmin (which is WSGI application)

And, in order to connect them from remote computer, I use those httpd configuration files:

For OpenProject:

Include /etc/openproject/addons/apache2/includes/server/*.conf

<VirtualHost *:80>
  ServerName 198.162.12.13
  DocumentRoot /opt/openproject/public

  ProxyRequests off

  Include /etc/openproject/addons/apache2/includes/vhost/*.conf

  # Can't use Location block since it would overshadow all the other proxypass directives on CentOS
  ProxyPass /openproject/ http://127.0.0.1:6000/openproject/ retry=0
  ProxyPassReverse /openproject/ http://127.0.0.1:6000/openproject/
</VirtualHost>

For pgAdmin:

<VirtualHost *:80>

    ServerName 198.162.214.23
    WSGIScriptAlias /pgadmin4 /usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi
    WSGIDaemonProcess pgadmin processes=1 threads=25

    <Directory /usr/lib/python2.7/site-packages/pgadmin4-web/>
        WSGIProcessGroup pgadmin
        WSGIApplicationGroup %{GLOBAL}
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
    </Directory>

</VirtualHost>

And now magic (for me) begins and where my question lies:

take a look at server names in both files, pgAdmin contains my actual IP address, while OpenProject has some random IP address.

With that setup, pgAdmin works, but OpenProject doesn't.

Generally, without configuration for pgAdmin, OpenProject works with any IP address, which is strange for me, so my first question is: why???

So, to sum up:

If I set up in both files my actual IP address, then OpenProject works, pgAdmin doesn't.

If I set up in both files some random IP address, then OpenProject works, pgAdmin doesn't.

If I set up actual IP for OpenProject, random for pgAdmin, then OpenProject works, pgAdmin doesn't.

If I set up random IP for OpenProject, actual IP for pgAdmin, then OpenProject doesn't work, but pgAdmin does.

Why it is so messed up? How to configure those files so both applications work as expected?

已采纳解答

原帖链接 · Hagen von Eitzen · CC BY-SA 4.0

Use DNS to create two names (e.g., openproject.example and pgadmin.example) pointing to the actual address (apparently 198.162.12.13) of your server. Configure these names in the respective ServerName settings, and use http://openproject.example and http://pgadmin.example to access them.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-01-19)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。