A
A
Anton2020-05-22 00:46:40
Apache HTTP Server
Anton, 2020-05-22 00:46:40

How to properly use ProxyPass and ProxyPassReverse in apache2?

I'm trying to connect the JSCX chat in Nextcloud to my own XMPP server. On the XMPP server (from the same local network), BOSH is configured and available at https://example.com:5281/http-bind .

How can I make https://example.com:5281/http-bind available at https://example.com/http-bind ?

According to the manual, you need to register it like this:
ProxyPass /http-bind/ example.com:5280/http-bind
ProxyPassReverse /http-bind/ example.com:5280/http-bind

But how and where exactly to register?
/etc/apache2/sites-available/ contains 3 files:
1) 000-default.conf:

spoiler
<VirtualHost _default_:80>
  DocumentRoot /var/www/nextcloud
   <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
   </IfModule>
</VirtualHost>

2) default-ssl.conf:
spoiler
<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin [email protected]
                DocumentRoot /var/www/html
                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
                SSLEngine on
                SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
                SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
        /VirtualHost>
</IfModule>

3) and example.conf:
spoiler
<IfModule mod_ssl.c>
  <VirtualHost _default_:443>
    DocumentRoot /var/www/nextcloud
ServerName example.com
    CustomLog /var/log/apache2/nc-access.log combined
    ErrorLog  /var/log/apache2/nc-error.log
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
  </VirtualHost>
  <Directory /var/www/nextcloud/>
    Options +FollowSymlinks
    AllowOverride All
    <IfModule mod_dav.c>
      Dav off
    </IfModule>
    LimitRequestBody 0
    SSLRenegBufferSize 10486000
  </Directory>
</IfModule>



I would be very grateful for advice. So far, unfortunately, it has not been possible to make friends with apache2, nothing else but the start page https://example.com is loaded.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question