Jump to content

Denarius DDNS NVS setup with Nginx and go-ipfs


buzzkillb
 Share

Recommended Posts

Say you want to run a blog behind IPFS and then use the Denarius DDNS NVS for your domain name because you are being censored for whatever reason. basic guide to do this, and just throw in a hugo or ghost blog platform into a directory. A few basic examples will be shown over time for the blog setup.

 

reference: https://www.linode.com/docs/guides/install-go-on-ubuntu/

install latest go for your OS
https://golang.org/dl/

wget https://golang.org/dl/go1.15.7.linux-amd64.tar.gz
tar xzvf go1.15.7.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local
nano ~/.profile

add
 

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

load into current shell instance
 

source ~/.profile

Grab carsens fork of go-ipfs daemon
 

sudo apt-get install libc6-dev gcc make
git clone https://github.com/carsenk/go-ipfs
cd go-ipfs
make build
cd cmd/ipfs
sudo cp ipfs /usr/local/bin

Initialize IPFS daemon

ipfs init

Add ipfs systemd

sudo nano  /etc/systemd/system/ipfs.service
[Unit]
Description=IPFS daemon
After=network.target

[Service]
### Uncomment the following line for custom ipfs datastore location
# Environment=IPFS_PATH=/path/to/your/ipfs/datastore
User=denarius
ExecStart=/usr/local/bin/ipfs daemon --enable-namesys-pubsub                     
Restart=always    

[Install]
WantedBy=multi-user.target

setup systemd

sudo systemctl restart ipfs
sudo systemctl status ipfs
sudo systemctl enable ipfs

to bypass your resolver
 

cd /etc
sudo rm resolv.conf
nano resolv.conf

Use Denarius DNS for name resolving

107.152.32.30
192.3.62.20

on Denarius wallet
name_new dns:wiki.d A=199.195.249.96|TXT=dnslink=/ipns/k2k4r8n1h4mclh1ovwewhe5wmz8dygrqoh6u5tr51puvf1e5waoz2c0h 9999

edit nginx
 

nano /etc/nginx/sites-available/default

This is for a full IPFS blog behind cloudflare for your regular domain, an onion address through TOR and your Denarius DDNS domain name to show how its all put together.
 

server {
    listen 80;
    listen [::]:80;
    server_name denarius.wiki;
    return 302 https://$server_name$request_uri;

}

server {
        listen 443 ssl;
        listen [::]:443 ssl http2;
        ssl on;

        ssl_certificate /etc/ssl/certs/cert.pem;
        ssl_certificate_key /etc/ssl/private/key.pem;

        location / {
                proxy_pass    http://127.0.0.1:8080;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;
        }
}
server {
listen   127.0.0.1:80;
server_name fpn2nkmpvmp4ruzjiyn7hvwhfklhcptr7pukhyoe4et5ztte24ehpzqd.onion;

error_log   /var/log/nginx/hidden_service.error.log;
access_log  off;

#location / {
#                proxy_pass    http://localhost:8080/ipns/denarius.wiki;
#                proxy_http_version 1.1;
#                proxy_set_header Upgrade $http_upgrade;
#                proxy_set_header Connection 'upgrade';
#                proxy_set_header Host $host;
#                proxy_cache_bypass $http_upgrade;


location / {
    root /usr/share/nginx/html;
    index index.html index.htm index.nginx-debian.html;
    }
}


server {
    listen   80;
    server_name  wiki.d;
    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
    }
}

For purely using a Denarius domain all you need is

server {
    listen   80;
    server_name  wiki.d;
    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $remote_addr;
    }
}

Now restart nginx

sudo service nginx restart

In your Denarius wallet this is the debug console command.

You want an A record pointing to your vps and a TXT record pointing to the ipns or ipfs hash you created when you added your files to ipfs.

name_new dns:wiki.d A=199.195.249.96|TXT=dnslink=/ipns/k2k4r8n1h4mclh1ovwewhe5wmz8dygrqoh6u5tr51puvf1e5waoz2c0h 9999

If you put your website/blog into say ~/website run this command to get the hash

TMP=`/usr/local/bin/ipfs add -r /home/username/website/ | awk 'END{printf $2}'` && /usr/local/bin/ipfs name publish $TMP

The hash will pop out for your IPNS and IPFS hashes to put in your TXT record. You can't screw anything up, so don't be scared to mess up trying stuff.

Different ways to view the Denarius Wiki

https://denarius.wiki/
https://ipfs.denarius.io/ipns/denarius.wiki/

http://fpn2nkmpvmp4ruzjiyn7hvwhfklhcptr7pukhyoe4et5ztte24ehpzqd.onion/
http://wiki.d
https://ipfs.denarius.io/ipns/wiki.d/

  • The D 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...