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.
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]
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.
Thanked by 1Ympker
Comments
Wait a minute. Why on earth would you want to install wp in fkin root dir????
Did you define the locations in your wp-config.php?
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
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.
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?
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.
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;
}
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.
I just need working WordPress installation in example.org/blog. That's it.
Here is complete Nginx configuration file.
https://pastebin.com/FNW9rVdV
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:
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 typoseems all issues are sorted after adding this.
https://iboxstore.com/unlock-software.html
Check you php Memory Limit, if it is too small, then it will have this problem too.
You know that public_html or html is considered the root folder of a web server right?
most of the thing sorted out after @JustAMacUser suggestion. Thanks all !