502 Bad Gateway when using a sub-domain

I am using version 0.10.6 and the current 502 Bad Gateway is only affecting my sub domain. Here is the Caddyfile

https://www.thedeveloper.club {
redir https://thedeveloper.club{uri}
}

https://thedeveloper.club {
gzip
tls luisalvaradox@gmail.com
root /var/www/html/tdc/public
hugo /var/www/html/tdc {
flag bind 0.0.0.0
}
expires {
match .js$ 35m
match .css$ 35m
match .html$ 35m
match .jpg$ 35m
match .png$ 35m
match .svg$ 35m
match .woff$ 35m
}
basicauth /admin username password
errors {
* stderr
404 404.html
}
}

https://store.thedeveloper.club {
gzip
tls luisalvaradox@gmail.com
root /var/www/html/store
ext .php .html .htm
fastcgi / 127.0.0.1:9000 php
expires {
match .js$ 35m
match .css$ 35m
match .html$ 35m
match .jpg$ 35m
match .png$ 35m
match .svg$ 35m
match .woff$ 35m
}
errors {
* stderr
404 404.html
}
}

When I add the https in the sub-domain store it fails giving me the 502 Bad Gateway.

My main domain is using hugo if that helps in any way, my store. sub domain is only using PHP.

Another 2 questions are:

I am getting the following in the terminal:

[WARNING] A database is going to be created for your Hugo instace at

/root/.caddy/hugo/48f0fbff97243a5e4e37e7e893ae5755.db. It is highly recommended that you set the ‘database’ option to ‘48f0fbff97243a5e4e37e7e893ae5755.db’

Where am I suppose to change the database option?

The last issue is this:

17/Aug/2017:16:28:02 +0000 [ERROR 502 /] dial tcp 127.0.0.1:9000: getsockopt: connection refused
17/Aug/2017:16:28:02 +0000 [NOTICE 502 /] could not load error page: open /var/www/html/store/stderr: no such file or directory

How can I fix this?

Hope this helps.

The 502 means that your fastcgi directive isn’t able to connect to php-fpm. Make sure your address in the Caddyfile and system permissions are correct.

The hugo warning, maybe @hacdias can answer. :slight_smile:

As for the error page, go ahead and file an issue. That should be an easy one to fix. (Should. :wink: )

2 Likes

Like always, really happy to see you helping out. Thank you friend.

Hey :slight_smile: About the warning, you can find more info here.

2 Likes

You were too late Henrique. Too late!!

60170756

Thank you buddy. With that and the information provided by Matt, it fixed all issues. Thank you both!

3 Likes

Hahaha. You’re welcome!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.