With cloudflare full strict ssl and nginx config. I get 404 error or its not redirected to the actual files in var/www/… But goes to root /var/www/html/
I am using cloudflare tunnel. And I followed digital ocean guide to install nginx, set cloudflare SSL with nginx
Nginx config
server {
listen 80;
listen [::]:80;
server_name wp.cloudcreatr.com;
#return 302 https://$server_name$request_uri;
}
server {
# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
server_name wp.cloudcreatr.com;
root /var/www/wp;
index index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
}
Enabling this gives redirect loop
#return 302 https://$server_name$request_uri
Also my cloudflare tunnel config file
tunnel: 796c6fde-bae0-476f-86d6-3dfd022d6143
credentials-file: /home/cloudcreatr/.cloudflared/796c6fde-bae0-476f-86d6-3dfd022d6143.json
ingress:
- hostname: wp.cloudcreatr.com
service: https://localhost:443
originRequest:
connectTimeout: 10s
noTLSVerify: true
- hostname: wpp.cloudcreatr.com
service: http://localhost:80
# Catch-all rule, which just responds with 404 if traffic doesn't match any of
# the earlier rules
- service: http_status:404
warp-routing:
enabled: true
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
It seems like that the Nginx server block for port 443 is missing some essential rules that are needed for WordPress websites.
For example, you should have
index.php
defined in theindex
list and also you need to have a location that handles all PHP requests:Also your
/
location needs to be updated to the following in order to handle the requests correctly:For more information I could suggest this tutorial here:
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-20-04
Hope that this helps. Best, Bobby