How-To: Access Web Control on Ubuntu Server using Nginx

Moderators: Site Moderators, FAHC Science Team

Post Reply
AndyBossert
Posts: 2
Joined: Sun Mar 29, 2020 1:17 pm

How-To: Access Web Control on Ubuntu Server using Nginx

Post by AndyBossert »

moin from Germany,

I rejoined the Folding@Home community due to the Corona pandemic and own 3 Ubuntu Servers in total where i run the fahclients.
It gets sometime annoying to manage them via remote: the web-allow configuration has to be adjusted everytime my home router ip adress gets changes (every 24h) ...

I havent found any other convinient solutions to address this issue (probably there are some, however i couldnt find them in the documentation ...) so i come out with my own "quick and dirty" solution by simply pass the web control interface via proxy_pass of the nginx http server (analogous approach with apache):

1. Setup the fahclient according to the documantation.

2. Install nginx server on your Linux machine (code example here with ubuntu):

Code: Select all

sudo apt update
sudo apt install nginx
3. Allow for port 80 connection (consult documentation ufw firewall or similar).

4. Open the fahclient config.xml file with editor of your choice:

Code: Select all

sudo nano /etc/fahclient/config.xml
5. Include the following lines within the <config></config> in the fahclient configuration files:

Code: Select all

<allow v='127.0.0.1'/>
<web-allow v='127.0.0.1'/>
...so it should look similar to this:

Code: Select all

<config>
  <!-- Folding Slot Configuration -->
  <gpu v='false'/>

  <!-- HTTP Server -->
  <allow v='127.0.0.1'/>

  <!-- Slot Control -->
  <power v='FULL'/>

  <!-- User Information -->
  <passkey v='somekey'/>
  <team v='0'/>
  <user v='someone'/>

  <!-- Web Server -->
  <web-allow v='127.0.0.1'/>

  <!-- Folding Slots -->
  <slot id='0' type='CPU'/>
</config>
6. Open the nginx default config file in sites-available folder with editor of your choice:

Code: Select all

sudo nano /etc/nginx/sites-available/default
7. Include the following lines within server { }:

Code: Select all

        location /foldingathome/ {
                proxy_pass http://127.0.0.1:7396/;
        }


...so it looks similar to this:

Code: Select all

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
        }

        # FAH proxy pass
        location /foldingathome/ {
                proxy_pass http://127.0.0.1:7396/;
        }

        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}
...this is an quick example without ssl
To enable this you have to setup ssl in nginx first (follow the documentation)

8. Restart both the fahclient and the nginx server:

Code: Select all

sudo /etc/init.d/FAHClient restart
service nginx restart
9. Access the web control interface via browser of your choice:

Code: Select all

http://youripadress/foldingathome/
Enjoy

PS. If someone has a better solution (also in terms of security) please let me know! :wink:
MobileGamesMotion
Posts: 46
Joined: Thu Mar 19, 2020 3:58 pm
Hardware configuration: Windows 7, Intel i7-6600U CPU on a laptop
Location: Antartica(JK actually is Canada)

Re: How-To: Access Web Control on Ubuntu Server using Nginx

Post by MobileGamesMotion »

Maybe you could use FAHMMhttp://fahmm.net/? It is a mobile app that you can use on an iPhone. to promote everything
Image
#StayAtHome #AlertNotAnxious #FoldForCOVID :) :idea: :egeek:
Basic help stuff:viewtopic.php?f=61&t=26036 | Find Your Stats:https://stats.foldingathome.org/donors
https://folding.extremeoverclocking.com/
AndyBossert
Posts: 2
Joined: Sun Mar 29, 2020 1:17 pm

Re: How-To: Access Web Control on Ubuntu Server using Nginx

Post by AndyBossert »

MobileGamesMotion wrote:Maybe you could use FAHMMhttp://fahmm.net/? It is a mobile app that you can use on an iPhone. to promote everything
Thank you for the suggestion, that looks awesome.
Unfortunately I have an android phone :lol:
Post Reply