What am I doing wrong to receive Loopback and REST API WordPress Errors? [closed]
I have solved it. It is two part.
Running curl -v example.com
returned a failure with my initial conf. After making some changes, I managed to get a 200. Those changes are to the wordpress.conf file:
upstream php {
server 127.0.0.1:9000;
}
server {
listen 80;
listen [::]:80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.domain.com;
# truncated conf
}
The crucial part here is www
for server_name
which I did not have before. My DNS records don't require www
. If I remove www
the request fails. This also explains why when I typed www.example.com
in the URL box I got a 403. I had an improper server setup there. Now it properly redirects any URL combination of http/https
or the presence/absence of www
to https://example.com
. After posting the question I also ended up finding the missing upstream php
block and added that. See comments on the question.
Loopbacks worked, but to a degree. WordPress was still saying there was an error. Thanks to these two comments, I found out why. To complete the loopback you need PHP FPM. Which does not exist for Windows. You can get around this by having nginx spawn an additional php-cgi.exe
process through the use of upstream php
like so:
upstream php {
server 127.0.0.1:9000;
server 127.0.0.1:9001;
}
This allows nginx to process the loopback requested by WordPress and then the error goes away, as I observed. Unfortunately, this is not viable. Just like the comment said, the php-cgi.exe
processes will eventually crash. Resulting in PHP completely stopping breaking the site.
Looks like I need Linux after all. Might have to change hardware that doesn't cause Linux to bug out.