Proxypassing
If you have installed software like SickRage or SABnzbd you'll by default get a URL featuring a port number and be unable to validly use the web UI via HTTPS. Using proxypass you'll be able neaten up the URL but perhaps more importantly get covered by the server's HTTPS certificate.
You'll need to execute some commands via SSH to configure your proxypass. There is a separate guide on how to connect to your slot via SSH.
Table of contents
Apache
First, let's open up a blank config file by copying and pasting the command below (where software is replaced by the name of the software):
nano ~/.apache2/conf.d/software.conf
The name of the file doesn't actually matter (though needs to end in .conf), but it's obviously better to have it clear for future reference.
The blank proxypass config is below:
Include /etc/apache2/mods-available/proxy.load Include /etc/apache2/mods-available/proxy_http.load Include /etc/apache2/mods-available/headers.load ProxyRequests Off ProxyPreserveHost On ProxyVia On ProxyPass /software http://10.0.0.1:port/${USER}/software ProxyPassReverse /software http://10.0.0.1:port/${USER}/software
In the above example, replace software with the name of the software - this will form part of our new URL. You should also replace port with the port number the software is running on. If this changes, the proxypass config will also need to be changed. Please note that you do not need to replace ${USER} in the above.
The result will be software that can be accessed via https://server.feralhosting.com/username/software. The section below has a working example which might be helpful to you.
Example with Apache
In this example, we've installed SickRage and can access it just fine via http://server.feralhosting.com:11702/username/sickrage. We want to use HTTPS instead, but cannot. We need proxypass! First, we open the blank config file with:
nano ~/.apache2/conf.d/sickrage.conf
We make the changes described above and our config looks like this:
Include /etc/apache2/mods-available/proxy.load Include /etc/apache2/mods-available/proxy_http.load Include /etc/apache2/mods-available/headers.load ProxyRequests Off ProxyPreserveHost On ProxyVia On ProxyPass /sickrage http://10.0.0.1:11702/${USER}/sickrage ProxyPassReverse /sickrage http://10.0.0.1:11702/${USER}/sickrage
We then need to reload the configs to be able to use the changes:
/usr/sbin/apache2ctl -k graceful
We can now access SickRage at https://server.feralhosting.com/username/sickrage.
Nginx
If you have made the switch to nginx you should use this section of the guide to configure proxypass.
Please note that if you had previously set up proxypass for software running under Apache, you'll need to redo the configs for nginx as they have a different format.
First, let's open up a blank config file by copying and pasting the command below (where software is replaced by the name of the software):
nano ~/.nginx/conf.d/000-default-server.d/software.conf
The name of the file doesn't actually matter (though needs to end in .conf), but it's obviously better to have it clear for future reference.
The blank proxypass config is below:
location /software { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_x_host; proxy_set_header X-NginX-Proxy true; rewrite /(.*) /username/$1 break; proxy_pass http://10.0.0.1:port/; proxy_redirect off; }
In the above example, replace software with the name of the software - this will form part of our new URL, and username with your username. You should also replace port with the port number the software is running on. If this changes, the proxypass config will also need to be changed.
The result will be software that can be accessed via https://server.feralhosting.com/username/software. The section below has a working example which might be helpful to you.
Example with nginx
In this example, we've installed SickRage and can access it just fine via http://server.feralhosting.com:11702/username/sickrage. We want to use HTTPS instead, but cannot. We need proxypass! First, we open the blank config file with:
nano ~/.nginx/conf.d/000-default-server.d/sickrage.conf
We make the changes described above and our config looks like this:
location /sickrage { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_x_host; proxy_set_header X-NginX-Proxy true; rewrite /(.*) /username/$1 break; proxy_pass http://10.0.0.1:11702/; proxy_redirect off; }
We then need to reload the configs to be able to use the changes:
/usr/sbin/nginx -s reload -c ~/.nginx/nginx.conf
We can now access SickRage at https://server.feralhosting.com/username/sickrage.
Proxypass issues
The guides and examples here assume you can run your software in the format http://server.feralhosting.com:port/username/software. Some software might hardcode a different format, for instance rewriting out the username. By default, SABnzbd is an example of this and needs its Python script edited before it can be proxypassed. If you're running software not even covered by a guide you should ensure it is set up to run in the correct "non-proxied" format first.
Please note that the examples above all use 10.0.0.1
as the IP of the local server. This is important as Nginx and Apache only have access to the local network on this IP.