Sorry! We will be back soon. after instal HTTPS in Ubuntu 16 using bench

After install https certificates on a clear Ubuntu 16.04 server, i get the Sorry I will be back soon message. the installation and the status appears bellow. There are some errors in the .logs to be check. I cannot find the solution. Please help… Thank you!!!

1.- Ubuntu 16.04 Ubuntu 16.04.2 LTS, minimal.

2.- Commands to get erpnext over http working
ssh log
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install wget python-minimal
sudo wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
sudo python install.py --production
Please enter mysql root password: xxxxxxx
Please enter the default Administrator user password: yyyyyyyy
Frappe/ERPNext has been successfully installed!
sudo systemctl enable supervisor
sudo reboot

http://192.168.1.xx/ <== success

3.- Install HTTPS certificate and redirect installation using bench
cd frappe_bench
bench config dns_multitenant on
point lll.uuuuuu.org to DMS=192.168.1.66

sudo apt-get install letsencrypt
sudo service nginx stop
sudo letsencrypt certonly --standalone -d lll.uuuuuu.org
    Enter email address: lll@uuuuuuu.com
    Pelease read the Terms of Service: Agree
        
 - Congratulations! Your certificate and chain have been saved at /etc/letsencrypt/live/lll.uuuuuu.org/fullchain.pem. etc....

sudo nano ~/frappe-bench/sites/site1.local/site_config.json
===>    "ssl_certificate": "/etc/letsencrypt/live/lll.uuuuuu.org/fullchain.pem",
===>    "ssl_certificate_key": "/etc/letsencrypt/live/lll.uuuuuu.org/privkey.pem"
#or used these two comands instead
xxxx>     bench set-ssl-certificate site1.local /etc/letsencrypt/live/lll.uuuuuu.org/fullchain.pem
xxxx>    bench set-ssl-key site1.local /etc/letsencrypt/live/lll.uuuuuu.org/privkey.pem

bench setup nginx
sudo service nginx restart

#error: it redirects correctly but the servers seems not good.
http://192.168.1.66 redirect to https://192.168.1.66 
http://lll.uuuuuu.org redirect to https://lll.uuuuuu.org/
    Sorry!We will be back soon. <== nginx server error

4.- some checks

#########################
service nginx status
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2017-03-02 19:02:11 EST; 2min 2s ago
Process: 8534 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 8545 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 8540 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 8547 (nginx)
Tasks: 3
Memory: 2.5M
CPU: 42ms
CGroup: /system.slice/nginx.service
├─8547 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
├─8548 nginx: worker process
└─8549 nginx: worker process

Mar 02 19:02:11 erpnext10 systemd[1]: Starting A high performance web server and a reverse proxy server…
Mar 02 19:02:11 erpnext10 systemd[1]: Started A high performance web server and a reverse proxy server.

#########################
sudo supervisorctl status
frappe-bench-redis:frappe-bench-redis-cache RUNNING pid 1326, uptime 3:33:31
frappe-bench-redis:frappe-bench-redis-queue RUNNING pid 1325, uptime 3:33:31
frappe-bench-redis:frappe-bench-redis-socketio RUNNING pid 1327, uptime 3:33:31
frappe-bench-web:frappe-bench-frappe-web RUNNING pid 2352, uptime 3:13:19
frappe-bench-web:frappe-bench-node-socketio RUNNING pid 2353, uptime 3:13:19
frappe-bench-workers:frappe-bench-frappe-default-worker-0 RUNNING pid 2341, uptime 3:13:20
frappe-bench-workers:frappe-bench-frappe-long-worker-0 RUNNING pid 2342, uptime 3:13:20
frappe-bench-workers:frappe-bench-frappe-schedule RUNNING pid 2340, uptime 3:13:20
frappe-bench-workers:frappe-bench-frappe-short-worker-0 RUNNING pid 2343, uptime 3:13:20

##########################
tail /home/frappe/frappe-bench/logs/web.log <==== why this?
lll.uuuuuu.org does not exist
lll.uuuuuu.org does not exist
192.168.1.66 does not exist
192.168.1.66 does not exist
192.168.1.66 does not exist
192.168.1.66 does not exist
192.168.1.66 does not exist
192.168.1.66 does not exist
lll.uuuuuu.org does not exist
lll.uuuuuu.org does not exist

############################## <=== why this?
2017/03/02 19:00:15 [error] 8465#8465: *3 upstream prematurely closed connection while reading response header from upstream, client: 107.77.215.66, server: site1.local, request: “GET /? HTTP/1.1”, upstream: “http://127.0.0.1:8000/?”, host: “lll.uuuuuu.org
2017/03/02 19:00:19 [error] 8465#8465: *5 upstream prematurely closed connection while reading response header from upstream, client: 107.77.215.66, server: site1.local, request: “GET /? HTTP/1.1”, upstream: “http://127.0.0.1:8000/?”, host: “lll.uuuuuu.org

It could be that your host_name mapping is incorrect. Your site folder name should match the url or you can add a host_name property in site_config.json to customize the host name / add an alias.

that is right, obviously i don’t want to publish the real site name, is an open server, but the problem is real. I can give you access to the server. I will send you the information in in a private, tell me how.

I don’t need the real name, just make sure the url matches the site folder name

also rebuild the config files

bench setup production

and restart supervisor and nginx

1 Like

Thank you! it worked. I just rename the site, rebuilt and ir worked:
mv site1.local lll.uuuuuu.org
bench setup nginx
Therefore is a condition that the site name be the same as the hostname. <== important

Now the question is how do i setup the system for multiple hostnames and also be accessible as https from the intranet? Can it be done from the bench or i have to manually configure the nginx?