odroid-xu4:software:ubuntu_nas:04_ddns

DDNS

Visit DuckDNS site and sign in.

Once register is done, your status dashboard appears that looks similar to above screenshot.
Enter the domains you need into “domains” part.

  • You haven't installed OMV, these are just for your understand.


And access that domain actually. We accessed the main page of OMV.

You can see that you are connected to the domain.

If you register at https://www.duckdns.org, you can see a DDNS Configuration guide using crontab in this page:https://www.duckdns.org/install.jsp.
Login, and their guide shows you the code that has your specific token and domains so that you can complete the configuration just by paste that codes.

So follow its instructions. Make sure that you proceed after getting a super user permission.


This is an example page.

You can apply it to the NAS services such as Transmission, Seafile, WebDAV, Wordpress.
If you want create a domain for your Wordpress service, you can make it like “example-wordpress.duckdns.org”.
But it can't support sub domain, like “seafile.hardkernel.duckdns.org” and “wordpress.hardkernel.duckdns.org”.

You don't need a “port-forward” anymore. Nginx can distinct the service and provide appropriate website by a server name.
So you should edit the server configuration files.

Before you proceed, it is recommended to modify global Nginx configuration file for using a long server name.

target
$ sudo vi /etc/nginx/nginx.conf

Uncomment the following line.

...
http {
    ...
    # Uncomment below.
    server_names_hash_bucket_size 64;
    ...
}
...

Save and reload Nginx.

target
$ sudo service nginx reload
target
$ sudo vi /etc/nginx/sites-available/transmission

There's no existing server file since Transmission has its own port number to access it.
And Transmission can't change its access URL to others, so we should use the Nginx as a reverse proxy server to apply a domain to Transmission.

Paste contents below into the opened Transmission server file:

server {
    listen 80;
    listen [::]:80;
    server_name my-transmission.duckdns.org;
 
    error_log /var/log/nginx/transmission.error.log;
    access_log /var/log/nginx/transmission.access.log;
 
    location / {
        return 301 http://$server_name/transmission/;
    }
 
    location ^~ /transmission {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_pass_header X-Transmission-Session-Id;
 
        location /transmission/rpc {
            proxy_pass http://127.0.0.1:9091;
        }
 
        location /transmission/web/ {
            proxy_pass http://127.0.0.1:9091;
        }
 
        location /transmission/upload {
            proxy_pass http://127.0.0.1:9091;
        }
 
        location /transmission/web/style/ {
            alias /usr/share/transmission/web/style/;
        }
 
        location /transmission/web/javascript/ {
            alias /usr/share/transmission/web/javascript/;
        }
 
        location /transmission/web/images/ {
            alias /usr/share/transmission/web/images/;
        }
 
        location /transmission/ {
            return 301 http://$server_name/transmission/web;
        }
    }
}

Enable it, and reload Nginx.

target
$ sudo ln -s /etc/nginx/sites-available/transmission /etc/nginx/sites-enabled/transmission
$ sudo service nginx reload

And you can access Transmission web GUI through your web browser with a domain address.

target
$ sudo vi /etc/nginx/sites-available/seafile

There's no existing server file since Seafile has its own port number to access it.
Unlike Transmission, Seafile has a room for changing its access method. Port number 8000 to access Seahub(Seafile GUI file manager) by default. You can change the port number or even can change its access URL. So it seems to be simple but you still need to create a new Nginx server file since only Nginx can open the Web server port.

Paste contents below into opened Nginx server file for Seafile:

server {
    listen 80;
    listen [::]:80;
    server_name my-seafile.duckdns.org;
 
    proxy_set_header X-Forwarded-For $remote_addr;
 
    location / {
        fastcgi_pass    127.0.0.1:8000;
        fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
        fastcgi_param   PATH_INFO           $fastcgi_script_name;
 
        fastcgi_param   SERVER_PROTOCOL     $server_protocol;
        fastcgi_param   QUERY_STRING        $query_string;
        fastcgi_param   REQUEST_METHOD      $request_method;
        fastcgi_param   CONTENT_TYPE        $content_type;
        fastcgi_param   CONTENT_LENGTH      $content_length;
        fastcgi_param   SERVER_ADDR         $server_addr;
        fastcgi_param   SERVER_PORT         $server_port;
        fastcgi_param   SERVER_NAME         $server_name;
        fastcgi_param   REMOTE_ADDR         $remote_addr;
        fastcgi_read_timeout 36000;
 
        client_max_body_size 0;
 
        access_log      /var/log/nginx/seahub.access.log;
        error_log       /var/log/nginx/seahub.error.log;
    }
 
    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
 
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        proxy_request_buffering off;
 
        send_timeout  36000s;
    }
 
    location /media {
        root /var/www/seafile/seafile-server-latest/seahub;
    }
}

Enable it, and reload Nginx.

target
$ sudo ln -s /etc/nginx/sites-available/seafile /etc/nginx/sites-enabled/seafile
$ sudo service nginx reload

You need to modify some setting files of Seafile.

target
$ sudo vi /var/www/seafile/conf/ccnet.conf

Change “SERVICE_URL” to like below:

SERVICE_URL = http://my-seafile.duckdns.org

And open other settings file.

target
$ sudo vi /var/www/seafile/conf/seahub_settings.py

Add a new line with your Seafile domain.

FILE_SERVER_ROOT = 'http://my-seafile.duckdns.org/seafhttp'

Modify service file to start seahub as a fastcgi mode.
Stop the Seafile/Seahub services.

target
$ sudo service seahub stop && sudo service seafile stop
 
# To make sure stopping Seafile/Seahub
$ cd /var/www/seafile/seafile-server-latest
$ sudo ./seahub.sh stop ; sudo ./seafile.sh stop
target
$ sudo sed --in-place=.bak '/ExecStart/,/start/s/start/start-fastcgi/' /etc/systemd/system/seahub.service
$ sudo systemctl daemon-reload

Lastly, start the Seafile/Seahub services again.

target
$ sudo service seafile start && sudo service seahub start

Now you can access your Seafile by your domain address.

As what we guided before, there's two options:

  • add a path for WebDAV into the default server file.
  • create a new server file for WebDAV.

And we'll show you how to apply a domain address in second one.

Open WebDAV server file.

target
$ sudo vi /etc/nginx/sites-available/sabredav

Change the port number and specify the domain address.

server {
    # Delete below.
    #listen 8100;
    #listen [::]:8100;
    #server_name _;
 
    listen 80;
    listen [::]:80;
    server_name my-webdav.duckdns.org;
    ...
}

Reload Nginx.

target
$ sudo service nginx reload
  • Wordpress migration appears to be not easy. If you have a problem with changing domain, visit Wordpress support page.

Open server file for Wordpress.

target
$ sudo vi /etc/nginx/sites-available/wordpress

Change the port number and specify the domain address.

server {
    # Delete below.
    #listen 8100;
    #listen [::]:8100;
    #server_name _;
 
    listen 80;
    listen [::]:80;
    server_name my-wordpress.duckdns.org;
    ...
}

Reload Nginx.

target
$ sudo service nginx reload

Open Wordpress's global configuration file and add following codes into the end of the file.

target
$ sudo vi /var/www/wordpress/wp-config.php
define('WP_HOME','http://my-wordpress.duckdns.org');
define('WP_SITEURL','http://my-wordpress.duckdns.org');

Open NextCloud server configuration file.

target
$ sudo vi /etc/nginx/sites-available/nextcloud

Change the port number and specify the domain address.

upstream php-handler {
    server unix:/var/run/php/php7.1-fpm.sock;
}
 
server {
    # Delete below.
    #listen 80;
    #listen [::]:80;
    #server_name _;
 
    listen 80;
    listen [::]:80;
    server_name my-nextcloud.duckdns.org;
    ...
}

Reload Nginx.

target
$ sudo service nginx reload

Change exist added trusted domain to the new domain issued from DuckDNS by editing the NextCloud's global configuration file.

target
$ sudo vi /var/www/nextcloud/config/config.php
$CONFIG = array (
  ...
  array (
    0 => 'localhost',
    #1 => 'your-odroid-ip:8002', 
    1 => 'my-nextcloud.duckdns.org',
  ),
  ...
)
  • odroid-xu4/software/ubuntu_nas/04_ddns.txt
  • Last modified: 2018/01/29 16:30
  • by joshua