Unable to resolve hostname

I am unable to use my site with a registered hostname but its working fine with IP:8000.

Steps taken till now:

  • I installed my ERPNext dev setup on a fresh digital ocean droplet ,

  • then i wanted to open it with a website like subdomain.domain.com … so i had a domain registered under registrar 1 & 1 ,

so i followed the steps to transfer the dns server .

1.entered the dns names of DO in the domain name


2. Then went to DO(digital ocean) and added the domain in “add a domain” part .
3,Went to A record and added my subdomain which i wanted in the hostname part instead of “@” and directed it to my droplet IP(doesnt let you specify port.)

  • Later i realized that you have to create the subdomain also in the registrar i.e 1 &1 , so went ahead and did that and changed its dns setting to DO as well.

On server side:

  • i setup production by sudo bench setup production username

  • and in common_site_config.json changed webserver_port to port 80 —"webserver_port": 80

.

  • checked in site_config.json of site under domain names it had my subdomain.domain name

Its still working for IP:8000
But when i enter the site it does not show , and shows temp 1&1 page :persevere:

What have i done Wrong?

ping subdomain.domain.com and check whether it points to your server IP.

check site name. site name should be similar as subdomain.domain.com.

have you setup nginx? bench setup nginx

@saurabh6790

pinged it , it is pointing to the server IP.

yes i did bench setup nginx and sudo service nginx reload

didn’t quite get what you mean , so you mean the name of my site on erp server?
i Named my site “erpdev” while creating it initially - so ping erpdev.erpdev ?

My nginx config file looks like this :

> upstream frappe-bench-frappe {
>     server 127.0.0.1:80 fail_timeout=0;
> }

> upstream frappe-bench-socketio-server {
>     server 127.0.0.1:9000 fail_timeout=0;
> }



> # setup maps


> # server blocks





> server {
>         listen 80;
>         server_name
>                 erpdev
>                 ;

>         root /home/erpdev/frappe-bench/sites;





>         location /assets {
>                 try_files $uri =404;
>         }

>         location ~ ^/protected/(.*) {
>                 internal;
>                 try_files /erpdev/$1 =404;
>         }

>         location /socket.io {
>                 proxy_http_version 1.1;
>                 proxy_set_header Upgrade $http_upgrade;
>                 proxy_set_header Connection "upgrade";
>                 proxy_set_header X-Frappe-Site-Name erpdev;
>                 proxy_set_header Origin $scheme://$http_host;
>                 proxy_set_header Host $host;

>                 proxy_pass http://frappe-bench-socketio-server;
>         }

>         location / {
>                 try_files /erpdev/public/$uri @webserver;
>         }

>         location @webserver {
>                 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>                 proxy_set_header X-Forwarded-Proto $scheme;
>                 proxy_set_header X-Frappe-Site-Name erpdev;
>                 proxy_set_header Host $host;
>                 proxy_set_header X-Use-X-Accel-Redirect True;
>                 proxy_read_timeout 120;
>                 proxy_redirect off;

>                 proxy_pass  http://frappe-bench-frappe;
>         }

>         # error pages
>         error_page 502 /502.html;
>         location /502.html {
>                 root /home/erpdev/.bench/bench/config/templates;
>                 internal;
>         }

>         # optimizations
>         sendfile on;
>         keepalive_timeout 15;
>         client_max_body_size 50m;
>         client_body_buffer_size 16K;
>         client_header_buffer_size 1k;

>         # enable gzip compresion
>         # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
>         gzip on;
>         gzip_http_version 1.1;
>         gzip_comp_level 5;
>         gzip_min_length 256;
>         gzip_proxied any;
>       gzip_vary on;
>         gzip_types
>                 application/atom+xml
>                 application/javascript
>                 application/json
>                 application/rss+xml
>                 application/vnd.ms-fontobject
>                 application/x-font-ttf
>                 application/font-woff
>                 application/x-web-app-manifest+json
>                 application/xhtml+xml
>                 application/xml
>                 font/opentype
>                 image/svg+xml
>                 text/css
>                 text/plain
>                 text/x-component
>                 ;
>                 # text/html is always compressed by HttpGzipModule
> }

anything wrong or is there some other reason for this.?

Set dns multitenant in config

bench config dns_multitenant on

then ,

bench setup nginx
sudo service nginx restart

Done ,yet same thing…

Also another thing that intrigues me is why is temporary page of 1&1(The registrar) appearing when i have transferred the dns to digital ocean(my hosting).

or this is normal behavior ?
Do you need to see the settings of my dns on 1&1 and DO?

Any suggestions on what should i do ?
what would i need to do to avoid this if i start over again? any particular steps/guidelines?

This is the setting page for my registrar for my sub-domain . Is the Destination proper?

please help me out…

Thanks

remove default from /etc/nginx/conf.d
Then sudo service nginx restart

ok thanks ,
So i redid my all steps from scratch -setting up domain ,configuring production etc
now my domain is working but i have to enter the port number for it like websitehost.com:8000
but when i just enter the site name like websitehost.com i get this :

Some issue with nginx again?
my /etc/nginx/sites-available has only default site.

Thanks a lot for your help so far and in advance for this.

Please share nginx and supervisor config

@saurabh6790

  • frappe-bench/config/nginx.conf

upstream frappe-bench-frappe {
server 127.0.0.1:80 fail_timeout=0;
}

upstream frappe-bench-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}

setup maps

map $host $site_name_jqtzbpf {
it965.com erpdev;
default $host;

}

server blocks

server {
listen 80;
server_name
erpdev
it965.com
;

    root /home/erpdev/frappe-bench/sites;
    location /assets {
            try_files $uri =404;
    }
    location ~ ^/protected/(.*) {
            internal;
            try_files /$site_name_jqtzbpf/$1 =404;
    }
    location /socket.io {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header X-Frappe-Site-Name $site_name_jqtzbpf;
            proxy_set_header Origin $scheme://$http_host;
            proxy_set_header Host $host;
            proxy_pass http://frappe-bench-socketio-server;
    }
    location / {
            try_files /$site_name_jqtzbpf/public/$uri @webserver;
    }
    location @webserver {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Frappe-Site-Name $site_name_jqtzbpf;
            proxy_set_header Host $host;
            proxy_set_header X-Use-X-Accel-Redirect True;
            proxy_read_timeout 120;
            proxy_redirect off;
            proxy_pass  http://frappe-bench-frappe;
    }
    # error pages
    error_page 502 /502.html;
    location /502.html {
            root /home/erpdev/.bench/bench/config/templates;
            internal;
    }
    # optimizations
    sendfile on;
    keepalive_timeout 15;
    client_max_body_size 50m;
    client_body_buffer_size 16K;
    client_header_buffer_size 1k;
    # enable gzip compresion
    # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
    gzip on;
    gzip_http_version 1.1;
    gzip_comp_level 5;
    gzip_min_length 256;
    gzip_proxied any;
    gzip_vary on;
    gzip_types
            application/atom+xml
            application/javascript
            application/json
            application/rss+xml
            application/vnd.ms-fontobject
            application/x-font-ttf
            application/font-woff
            application/x-web-app-manifest+json
            application/xhtml+xml
            application/xml
            font/opentype
            image/svg+xml
            image/x-icon
            text/css
            text/plain
            text/x-component
            ;
            # text/html is always compressed by HttpGzipModule

}

  • frappe-bench/config/supervisor.conf

; Notes:
; priority=1 --> Lower priorities indicate programs that start first and shut down last
; killasgroup=true --> send kill signal to child processes too

[program:frappe-bench-frappe-web]
command=/home/erpdev/frappe-bench/env/bin/gunicorn -b 127.0.0.1:80 -w 2 -t 120 frappe.app:application --preload
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/web.log
stderr_logfile=/home/erpdev/frappe-bench/logs/web.error.log
user=erpdev
directory=/home/erpdev/frappe-bench/sites

[program:frappe-bench-frappe-schedule]
command=/usr/local/bin/bench schedule
priority=3
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/schedule.log
stderr_logfile=/home/erpdev/frappe-bench/logs/schedule.error.log
user=erpdev
directory=/home/erpdev/frappe-bench

[program:frappe-bench-frappe-default-worker]
command=/usr/local/bin/bench worker --queue default
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/worker.log
stderr_logfile=/home/erpdev/frappe-bench/logs/worker.error.log
user=erpdev
stopwaitsecs=1560
directory=/home/erpdev/frappe-bench
killasgroup=true
numprocs=1
process_name=%(program_name)s-%(process_num)d

[program:frappe-bench-frappe-short-worker]
command=/usr/local/bin/bench worker --queue short
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/worker.log
stderr_logfile=/home/erpdev/frappe-bench/logs/worker.error.log
user=erpdev
stopwaitsecs=360
directory=/home/erpdev/frappe-bench
killasgroup=true
numprocs=1
process_name=%(program_name)s-%(process_num)d

[program:frappe-bench-frappe-long-worker]
command=/usr/local/bin/bench worker --queue long
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/worker.log
stderr_logfile=/home/erpdev/frappe-bench/logs/worker.error.log
user=erpdev
stopwaitsecs=1560
directory=/home/erpdev/frappe-bench
killasgroup=true
numprocs=1
process_name=%(program_name)s-%(process_num)d

[program:frappe-bench-redis-cache]
command=/usr/bin/redis-server /home/erpdev/frappe-bench/config/redis_cache.conf
priority=1
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/redis-cache.log
stderr_logfile=/home/erpdev/frappe-bench/logs/redis-cache.error.log
user=erpdev
directory=/home/erpdev/frappe-bench/sites

[program:frappe-bench-redis-queue]
command=/usr/bin/redis-server /home/erpdev/frappe-bench/config/redis_queue.conf
priority=1
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/redis-queue.log
stderr_logfile=/home/erpdev/frappe-bench/logs/redis-queue.error.log
user=erpdev
directory=/home/erpdev/frappe-bench/sites

[program:frappe-bench-redis-socketio]
command=/usr/bin/redis-server /home/erpdev/frappe-bench/config/redis_socketio.conf
priority=1
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/redis-socketio.log
stderr_logfile=/home/erpdev/frappe-bench/logs/redis-socketio.error.log
user=erpdev
directory=/home/erpdev/frappe-bench/sites

[program:frappe-bench-node-socketio]
command=/usr/bin/node /home/erpdev/frappe-bench/apps/frappe/socketio.js
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/node-socketio.log
stderr_logfile=/home/erpdev/frappe-bench/logs/node-socketio.error.log
user=erpdev
directory=/home/erpdev/frappe-bench

[group:frappe-bench-web]
programs=frappe-bench-frappe-web,frappe-bench-node-socketio

[group:frappe-bench-workers]
programs=frappe-bench-frappe-schedule,frappe-bench-frappe-default-worker,frappe-bench-frappe-short-worker,frappe-bench-frappe-long-worker

[group:frappe-bench-redis]
programs=frappe-bench-redis-cache,frappe-bench-redis-queue,frappe-bench-redis-socketio

  • /etc/supervisor/supervisord.conf

; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; (‘AUTO’ child log dir, default $TEMP)

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket

; The [include] section can just contain the “files” setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files cannot
; include files themselves.

[include]
files = /etc/supervisor/conf.d/*.conf

This seems suspicious. It should be 8000 instead of 80 in both nginx as well as in supervisor.

Worked ,
Changed That to 8000 on both conf files , restarted both and sites finally working without hassle
.
Thanks a ton.:relieved::smiley:

@saurabh6790
Just a quick question if i want it to go back in developer mode for some changes , so i ll have to do theses steps https://github.com/frappe/bench/wiki/Stopping-Production-and-starting-Development
will i still be able to access the site normally as now ?
else have to access it through IP again , do the changes and then re-setup production ?

Hi @saurabh6790

I’m having the same issues as @Taher_Khalil above. Have gone through your recommended steps to resolve but still cannot access via dns multitennancy on digital ocean?

I attache both Supervisor and Nginx cof files:

Any advice would be greatly appreciated.

Paul

upstream frappe-bench-frappe {
server 127.0.0.1:8000 fail_timeout=0;
}

upstream frappe-bench-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}

setup maps

map $host $site_name_fotgtaj {
beecreative.hayora360.com beecreative.hayora360.com;
default $host;

}

server blocks

server {
listen 80;
server_name
beecreative.hayora360.com
beecreative.hayora360.com
;

    root /home/frappe/frappe-bench/sites;

    

    

    location /assets {
            try_files $uri =404;
    }

    location ~ ^/protected/(.*) {
            internal;
            try_files /$site_name_fotgtaj/$1 =404;
    }

    location /socket.io {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header X-Frappe-Site-Name $site_name_fotgtaj;
            proxy_set_header Origin $scheme://$http_host;
            proxy_set_header Host $host;

            proxy_pass http://frappe-bench-socketio-server;

; Notes:
; priority=1 --> Lower priorities indicate programs that start first and shut down last
; killasgroup=true --> send kill signal to child processes too

[program:frappe-bench-frappe-web]
command=/home/frappe/frappe-bench/env/bin/gunicorn -b 127.0.0.1:8000 -w 2 -t 120 frappe.app:application --preload
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/frappe/frappe-bench/logs/web.log
stderr_logfile=/home/frappe/frappe-bench/logs/web.error.log
user=frappe
directory=/home/frappe/frappe-bench/sites

[program:frappe-bench-frappe-schedule]
command=/usr/local/bin/bench schedule
priority=3
autostart=true
autorestart=true
stdout_logfile=/home/frappe/frappe-bench/logs/schedule.log
stderr_logfile=/home/frappe/frappe-bench/logs/schedule.error.log
user=frappe
directory=/home/frappe/frappe-bench

[program:frappe-bench-frappe-default-worker]
command=/usr/local/bin/bench worker --queue default
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/frappe/frappe-bench/logs/worker.log
stderr_logfile=/home/frappe/frappe-bench/logs/worker.error.log
user=frappe
stopwaitsecs=1560
directory=/home/frappe/frappe-bench
killasgroup=true
numprocs=1
process_name=%(program_name)s-%(process_num)d

[program:frappe-bench-frappe-short-worker]
command=/usr/local/bin/bench worker --queue short
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/frappe/frappe-bench/logs/worker.log
stderr_logfile=/home/frappe/frappe-bench/logs/worker.error.log
user=frappe
stopwaitsecs=360
directory=/home/frappe/frappe-bench
killasgroup=true
numprocs=1
process_name=%(program_name)s-%(process_num)d

I did a mistake. I didn’t set site name same as domain name, what can I do now? can I change site name now, if yes so how?
Please explain me…
Thank you…