I followed this guide to have Nginx function as a forward proxy for apache.. However, when I attempt to allow Nginx to serve static files and pass php stuff off to Apache, I get an error about being redirected too many times.
My nginx server block for apache proxy-ing looks like this
server {
listen 80;
listen 443 ssl;
server_name harmonherring.win www.harmonherring.win;
root /var/www/harmonherring.win;
index index.php index.html index.html;
#ssl on;
ssl_certificate /etc/letsencrypt/live/www.harmonherring.win/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.harmonherring.win/privkey.pem;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://159.65.176.109:8080;
}
location ~ /\. {
deny all;
}
}
Any help would be much appreciated, thanks!
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.
Hi,
try to specify all possible extensions and everything else ( non static files ) proxy_pass to Apache2 to handle it. Something like this:
I have the same problem with Wordpress and is creating 21 redirects(301) and then the browser will show an error, I created tried to exclude the extensions but didn’t work. Any other suggestion?