I have a problem with my Apache2 web server as reverse proxy server. The simplified server setup with my domain "example.com" looks like this:
If clients now go to the page https://example.com/guacamole
, then the Apache2 web server should forward the requests to the Tomcat server (https://127.0.0.1:8080/guacamole
). This part works.
If clients go to https://example.com/mydjangoproject
, then the Apache2 web server should forward requests to the web server using Gunicorn and the Django project (https://192.168.30.5:8000
). However, this configuration works only partially. The page https://example.com/mydjangoproject
shows the main page of the Django project, but when calling the admin page https://example.com/mydjangoproject/admin
the django application gives the error that the page http://192.168.30.5:8000//admin
does not exist. It seems like the sub-URL "/mydjangoproject/" is removed when calling the admin page. What could that be?
This is my configuration:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
JKMount /* ajp13_worker
SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
ProxyPreserveHost On
ProxyPass /static/ !
ProxyPass /mydjangoproject https://192.168.30.5:8000/
ProxyPassReverse /mydjangoproject https://192.168.30.5:8000/
</VirtualHost>
</IfModule>
Thanks for your help!
Edit:
When i try to enter the admin-page via https://example.com/mydjangoproject/admin
then this error occurs:
proxypass
directives. Since/mydjangoproject
is proxyinghttps://192.168.30.5:8000/
, thenhttps://example.com/mydjangoproject/admin
will return whatever it finds athttps://192.168.30.5:8000/admin
. Is the admin panel you're expecting being served from there?