Skip to content

Troubleshooting Workarounds

Marcel edited this page Apr 26, 2024 · 4 revisions

Synapse (Matrix) nginx delegation example for Zoraxy

server {
    listen 8200;
    listen [::]:8200;
    server_name MATRIX.YOUR.DOMAIN;

     location /.well-known/matrix/server {
        add_header Access-Control-Allow-Origin '*';
        return 200 '{ "m.server": "MATRIX.YOUR.DOMAIN:443" }';
    }

    location /.well-known/matrix/client {
        # If your sever_name here doesn't match your matrix homeserver URL
        # (e.g. hostname.com as server_name and matrix.hostname.com as homeserver URL)
        add_header Access-Control-Allow-Origin '*';
        return 200 '{ "m.homeserver": { "base_url": "https://MATRIX.YOUR.DOMAIN" } }';
    }

    location /_matrix {
        proxy_pass http://172.40.0.50:8008;
    }
}

Fixing Wordpress "Mixed content" or "CSP header" errors

Apache needs to be informed, that HTTPS is already server by another proxy, Zoraxy in our case.

Now your site can look like this:

wp1 Adminpanel

We need to edit the wp-config.php file as root user. Switch to root user:

sudo su

The file is located at the Wordpress-webroot (/var/www/html/wordpress).

cd /var/www/html/wordpress

Sidenote:

If you use Wordpress in Docker and you used the standard docker-compose example the file should located at /var/lib/docker/volumes/wordpress_wordpress/_data/wp-config.php

Open the wp-config.php with editor as root

nano wp-config.php

Put in these lines after the "<?php" part of the file

if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) || (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) { $_SERVER['HTTPS'] = 'on'; }

addedlines

Save the file with CTRL + O and leave nano with CTRL + X

Now we need to edit the vHost for apache:

nano /etc/apache2/sites-available/wordpress.conf

Add this under ServerName

     Protocols h2 h2c http/1.1
     RemoteIPHeader X-Forwarded-For
     SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on

Save the file with CTRL + O and leave nano with CTRL + X

Restart apache with sudo systemctl restart apache2 and reload your page!

finished Adminpanel

You can now leave the root shell with

exit

Tested with Wordpress and Apache on a hostinstallation and Wordpress in Docker (wordpress:latest) with existing sites.

Install Go on your host (Debian 11 / Ubuntu 22.04)

Installing Go is required to build Zoraxy. The packages in the Ubuntu and Debian repositories provide an outdated version (v1.18 for Ubuntu 22.04 and v1.15 for Debian Bullseye), but Zoraxy needs v1.20.

For Ubuntu, you can use the snap package, which is easily installed with:

sudo snap install go --classic

On Debian we need a few more steps, but it is not this hard:

  1. Copy Go to your host:

    wget https://go.dev/dl/go1.20.4.linux-amd64.tar.gz

  2. Extract the archive and copy it to the right place:

    sudo tar -C /usr/local -xzf go1.20.4.linux-amd64.tar.gz

  3. Add Go to PATH:

    echo "export PATH=/usr/local/go/bin:${PATH}" | sudo tee -a $HOME/.profile

  4. Normally you would need to logout and login again, or you run this to apply:

    source $HOME/.profile

  5. Check Go version with:

    go version

go

Successfully installed Go