Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


WordPress on sub directory inside in root. [NGINX]
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

WordPress on sub directory inside in root. [NGINX]

HaroldMHaroldM Member

I tried to install WordPress in a sub directory inside the main root directory. I already have some rewrites for the main root directory because of that I create new location section in nginx configuration file.

The issue is all the things are working except the wp-admin area. It's giving too many redirect error. can anyone help me please. Here is my nginx configuration I'm using.

https://pastebin.com/FNW9rVdV

Thanked by 1Ympker

Comments

  • Wait a minute. Why on earth would you want to install wp in fkin root dir????

    Thanked by 1jaypeesmith
  • Did you define the locations in your wp-config.php?

  • blackjack4494 said: Wait a minute. Why on earth would you want to install wp in fkin root dir????

    Here is the thing. My main website working without any issues in "eample.com" so now I just need to put my WordPress related blog to "example.com/blog" that's it :)

    clarity_64 said: Did you define the locations in your wp-config.php?

    which locations please ? can you give little help on this please ?

  • https://codex.wordpress.org/Changing_The_Site_URL

    You just have two define the two variables to point to the folder, in my past experience.

  • My suggestion, take a backup (WP Clone is a great option) of the existing site. Create the /blog folder. Do a fresh install of WP, Restore using WP-Clone again.

    This way the wp-admin is accessed as example.com/blog/wp-admin

    This is much cleaner IMO rather than tinkering with the config variables.

  • WSSWSS Member

    A complete reinstallation which changes the config variables and uses network overhead to reinstall the same files is cleaner than editing the config yourself- how?

  • HaroldMHaroldM Member
    edited July 2017

    I tried installing fresh WP but not working.

    https://www.example.org/blog - FINE
    https://www.example.org/blog/ - FINE
    https://www.example.org/blog/wp-login.php - FINE
    https://www.example.org/blog/wp-admin - NO ( ERR_TOO_MANY_REDIRECTS )
    https://www.example.org/blog/wp-admin/ - NO ( ERR_TOO_MANY_REDIRECTS )

    seems like something wrong with my Nginx configuration. am I doing right in my Nginx config ?

    can someone show me nginx config for WP in a sub directory ?

  • To clarify, do you want the contents of your blog to be available to visitors from www.example.org or from www.example.org/blog?

  • @WSS: Yes, it is cleaner, since you start with a clean slate. Considering that the OP wasn't sure how to make the config changes (or worried he may screw things up). Like I said, it was my recommendation and one which I would be comfortable executing.

  • clarity_64clarity_64 Member
    edited July 2017

    Do you have the try files stuff in the /blog location in nginx? It should be something like this.

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

  • YuraYura Member

    @WSS said:
    A complete reinstallation which changes the config variables and uses network overhead to reinstall the same files is cleaner than editing the config yourself- how?

    It's Wordpress. It's a 14yo PHP project... You can edit a config file and open a black hole into another dimension. Better uninstall it and use BitBleach just in case.

  • WSSWSS Member

    @Yura said:

    @WSS said:
    A complete reinstallation which changes the config variables and uses network overhead to reinstall the same files is cleaner than editing the config yourself- how?

    It's Wordpress. It's a 14yo PHP project... You can edit a config file and open a black hole into another dimension. Better uninstall it and use BitBleach just in case.

    I'd rather keep my decade-and-change old installation of TextPattern.

  • JustAMacUser said: To clarify, do you want the contents of your blog to be available to visitors from www.example.org or from www.example.org/blog?

    I just need working WordPress installation in example.org/blog. That's it.

    clarity_64 said: Do you have the try files stuff in the /blog location in nginx? It should be something like this.

    Here is complete Nginx configuration file.

    https://pastebin.com/FNW9rVdV

    ramesh_vish said: Yes, it is cleaner, since you start with a clean slate. Considering that the OP wasn't sure how to make the config changes (or worried he may screw things up). Like I said, it was my recommendation and one which I would be comfortable executing.

    I know about changing config file, actually most of my WordPress sites are using my own coded themes + plugins. This is the first time I'm deploying WP in a sub directory inside a document root. :/

    I think issue is in my nginx configuration.

  • First, you have two location @extensionless-php { } sections. I don't think that's causing the problem but still..

    Next, I think your blog section should something like this:

    location /blog {
        index index.php;
        try_files $uri $uri/ /blog/index.php;
    }
    

    It's difficult for us to troubleshoot this without seeing how your other application works. It kind of seems like both are fighting to be the frontend controller, which is just asking for trouble.

  • JustAMacUser said: It's difficult for us to troubleshoot this without seeing how your other application works. It kind of seems like both are fighting to be the frontend controller, which is just asking for trouble.

    my other application is just a HTML website created using bootstrap. All the pages have .php extension & nginx helps to remove .php using that @extensionless-php part.

    2 @extensionless-php is a typo :D

    JustAMacUser said: Next, I think your blog section should something like this:

    seems all issues are sorted after adding this. :)

  • @HaroldM said:
    I tried installing fresh WP but not working.

    https://www.example.org/blog - FINE
    https://www.example.org/blog/ - FINE
    https://www.example.org/blog/wp-login.php - FINE
    https://www.example.org/blog/wp-admin - NO ( ERR_TOO_MANY_REDIRECTS )
    https://www.example.org/blog/wp-admin/ - NO ( ERR_TOO_MANY_REDIRECTS )

    seems like something wrong with my Nginx configuration. am I doing right in my Nginx config ?

    can someone show me nginx config for WP in a sub directory ?

    Check you php Memory Limit, if it is too small, then it will have this problem too.

  • HxxxHxxx Member

    You know that public_html or html is considered the root folder of a web server right?

    @blackjack4494 said:
    Wait a minute. Why on earth would you want to install wp in fkin root dir????

  • HaroldMHaroldM Member
    edited July 2017

    most of the thing sorted out after @JustAMacUser suggestion. Thanks all ! <3

    Thanked by 1AuroraZ
Sign In or Register to comment.