1

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?

2

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.

  • Will it be visible from other comouter? – Michał Turczyn Jan 19 at 17:27
  • Also, my acutal IP is 192.168.214.23. OpenProject runs on whatever IP address (specified in ServerName), which seems also strange to me. – Michał Turczyn Jan 19 at 17:53
  • And how to "use DNS"? Do you mean to specify ServerName to those names? – Michał Turczyn Jan 19 at 19:48
2

To run multiple separate web sites / applications on a single IP-address you have roughly three options:

  • You install each application in a different URL paths i.e. $(hostname)/app1 and /app2.

If both applications need to be installed in the root / your options are to

  • run multiple virtual web servers on different port numbers and http://$(hostname):81/ will show one application and http://$(hostname):82/ can show a different one

  • run multiple virtual web servers under different host names and do name based virtual hosting. Then http://app1.example.com/ can show one application and http://app2.example.com/ will show another

Your config appears an attempt to use that last option but since both VirtualHost definitions get configured with the same ServerName Apache cannot distinguish them.

  • Note that the ServerNames are different, though in an unexpected way ... – Hagen von Eitzen Jan 19 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.