The /etc/hosts
file should have been updated by hostnamectl set-hostname
.
The /etc/hosts
file should begin like this:
127.0.0.1 localhost
127.0.1.1 web-1.alliancechemical.com
When I run hostname
I get web-1.alliancechemical.com
/etc/hosts
must also be adjusted as above (if this wasnât done by the hostnamectl
tool).
The line
127.0.1.1 alliancechemical.com alliancechemical
is wrong, it should be
127.0.1.1 web-1
(the subdomain should suffice).
If the tool didnât change it, you can edit it manually.
Yaaa!! After applying the hosts edit. I can curl https://alliancechemical.com/saitspress/packages.json
and I get the expected response.
Going to try to redeploy now.
Everything worked! Appreciate your patience @strarsis . I marked your solution hopefully it helps someone else too.
After some testing with the Ubuntu setup I noticed that the default Ubuntu server setup doesnât allow a domain, rather just a hostname.
I try to find out how this issue can arise, so it can be warned about in the Trellis docs.
How have you installed that Ubuntu instance? A base image from Digital Ocean, its setup assistant?
You specified a complete domain, not just a hostname?
I followed this guide when setting up my server on DO
When it asked for droplet name thatâs where I named it alliancechemical.com
1 Like
I created a new issue for adding a warning about this to the Trellis docs:
opened 10:21PM - 26 Jan 23 UTC
enhancement
### Terms
- [X] I have read the [guidelines for Contributing to Roots Projects]⌠(https://github.com/roots/.github/blob/master/CONTRIBUTING.md)
- [X] This request is not a duplicate of an existing issue
- [X] This is not a personal support request that should be posted on the [Roots Discourse](https://discourse.roots.io/) community
### Summary
When a Trellis web server has a hostname assigned that is also used as the host of a WordPress site in that same web server, loopback connection problems occur.
(A loopback connection being a connection of that web server (commonly from inside the WordPress PHP app) to its own (public) host.)
As the `/etc/hosts` has a default mapping of the server hostname to `127.0.0.1`, also at the very top (so it will always win when resolving the hostname on that system), the hostname on that system will always and immediately be resolved to (default IPv4 localhost) `127.0.0.1`.
`nginx` on the Trellis web server listens on the public IP address(es) â also on localhost (`127.0.0.1`), but isn't configured the same for localhost connections, TLS among other things. Therefore loopback connections for this host will fail.
It makes sense to add a warning to the Trellis documentation about using a hostname (as a domain) for the web server, that also one of its WordPress sites uses, as this will cause issues with loopback connections for that site domain.
### Motivation
#### Why are we doing this?
Prevent issues with loopback connections, also helping with finding out about this issues for existing web server installations that already made that mistake.
#### What use cases does it support?
All use cases I am aware of.
#### What is the expected outcome?
Prevent this issue from occurring, also helping affected server admins.
#### Potential conflicts / foreseeable issues
No real conflicts. It should be very easy to set up a separate host name for the web server itself, like a subdomain (e.g. `web-1.web-agency.tld`).
### Additional Context
roots.io Discourse discussion where this issue was discovered:
https://discourse.roots.io/t/ssl3-read-bytes-tlsv1-unrecognized-name-downloading-domain-satispress-packages-json/24639/1
2 Likes