Nginx misconfig after CLI wordpress install

I get this screen after running my setup script:


If I:

  1. go to the panel
  2. uncheck proxy support
  3. save
  4. check proxy support again
  5. and save again

then everything works perfect, I can see the webpage, the let’s encrypt certificate works fine…

I would like to have a flawless script so that we don’t have to mess around activating and deactivating back and forth.

My install script basically does this:
$HESTIA/bin/v-add-user $username $hst_password $hst_email $hst_plan
$HESTIA/bin/v-add-web-domain $username $domain
wp core download --locale=$wp_locale
$HESTIA/bin/v-add-database $username $db_name $db_user $db_pass
wp config create --dbname=$db_name --dbuser=$db_user --dbpass=$db_pass --locale=$wp_locale --force
wp core install --url=$domain --title="$wp_title" --admin_user=$wp_user --admin_password=$wp_pass --admin_email=$wp_email

Import WP
wp db import $file
unzip -qqo $wp-content

Add LE
$HESTIA/bin/v-add-letsencrypt-domain $username $domain www.$domain

And then I try to fix nginx
$HESTIA/bin/v-delete-web-domain-proxy $username $domain
$HESTIA/bin/v-add-web-domain-proxy $username $domain default

I have tried adding, then deleting and adding and then deleting, adding and restarting.

What am I doing wrong?

What happens if you do nginx -t after the install?

nginx -t

nginx: [warn] “ssl_stapling” ignored, issuer certificate not found for certificate “/home/”
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful