问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
