• Description:-
    We have our main website xyz.com(served by Amazon API Gateway and Load Balancer) and want our blogs to be present on xyz.com/blogs. So, we have set up Amazon API Gateway and Load Balancer to redirect any request of the for xyz.com/blogs to the EC2 containing WordPress with Nginx.

    Problem:-
    The problem that we are facing is, the home page is rendered fine but when we try to render any other page, e.g:- xyz.com/blogs/my-first-post/ or xyz.com/blogs/wp-admin then it gets stuck over there and nothing comes as response. As a part of our initial debugging, we found out that WordPress is making redirections to the Network Load Balancer url, (which as per our guess) is not accessible and we are not getting any response.

    This is how our defualt nginx conf looks like (/etc/nginx/conf.d/xyz_blogs.conf), which we got from this link => WordPress|Nginx

    # Upstream to abstract backend connection(s) for php
    upstream php {
            server unix:/tmp/php-cgi.socket;
            server 127.0.0.1:9000;
    }
    
    server {
            ## Your website name goes here.
            server_name xyz.com;
            ## Your only path reference.
            root /var/www/html;
            ## This should be in your http block and if it is, it's not needed here.
            index index.php;
    
            location = /favicon.ico {
                    log_not_found off;
                    access_log off;
            }
    
            location = /robots.txt {
                    allow all;
                    log_not_found off;
                    access_log off;
            }
    
            location / {
                    # This is cool because no php is touched for static content.
                    # include the "?$args" part so non-default permalinks doesn't break when using query string
                    try_files $uri $uri/ /index.php?$args;
            }
    
            location ~ \.php$ {
                    #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                    include fastcgi.conf;
                    fastcgi_intercept_errors on;
                    fastcgi_pass php;
            }
    
            location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                    expires max;
                    log_not_found off;
            }
    }

    How shall we resolve this issue?
    A prior thanks for any help given hereby.

    • This topic was modified 4 years, 9 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello!
    Please give correct url of website for inspection.
    Try Settings->Permalinks change settings on permalink page and then save.
    Hopefully it will resolve your issue, in case of any further issue let me know without any hasitation.
    Cheers!

    Thread Starter rituraj2014

    (@rituraj2014)

    @shafiq1010
    Thank you for the response.
    The issue here is not related to permalink.
    It’s basically related to the Amazon API Gateway and the nginx redirection, where wrodpress is generating it’s own redirection link to the Amazon Loab Balancer.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Facing redirection issue while setting up WordPress with Nginx via Amazon API Ga’ is closed to new replies.