Nginx + Apache + Wordpress = Infinite Redirect

0

I'm breaking my head for hours .. I'm new to these server things, so while I tried to follow some tutorials, I got to understand a bit more about how it works.

The question is, I have Nginx as a reverse proxy, Apache, and I have the following settings in both:

In Nginx, I have this:

server {
    listen 80;
    listen 443 ssl;
    server_name xxx.com www.xxx.com;

#ssl on;
ssl_certificate /etc/webmin/letsencrypt-cert.pem;
ssl_certificate_key /etc/webmin/letsencrypt-key.pem;


root /var/www/html/;
index index.php index.htm index.html;

location / {
    try_files $uri $uri/ /index.php;
    #try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
    proxy_pass http://xxx.xx.xx.xxx:8080;
    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-Proto $scheme;
}




location ~ /\. {
    deny all;
}


}

The idea is for Nginx to point to apache, where it will render the page, right?

Well, it understands .htaccess, and so I decided to put Apache to run along with Nginx (other people say that it is superior to dynamic content, but I do not understand it).

It works when I access the /wp-admin but when I access the main page or the pages of the posts, the error occurs:

  

Incorrect forwarding

     

Firefox has detected that the server is redirecting the request   to this address in a way that will never be completed.

     

This issue can be caused by opting out or refusing to accept cookies.

Anyway, I'm trying to figure it out here, but maybe some of you have already gone through this and can definitely help me get the website up !!

Ps: Any missing data you need, please let me know.

Thank you, Alexandre

UPDATE:

I have modified the NGINX configuration, and now it works.

#location / {
 #   try_files $uri $uri/ /index.php;
    #try_files $uri $uri/ /index.php?$args;
#}

location / {
    proxy_pass http://xxx.xx.xx.xxx:8080;
    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-Proto $scheme;
}

Now I just need to see how to do for Nginx to serve static content , as I understand the settings are passing everything to apache.

    
asked by anonymous 06.05.2018 / 00:08

0 answers