I am running a blog on blog.example.com. I am using nginx as proxy for example.com/blog. I would like to change word press site URL and word press URL . When i change site URL preview of post breaks. When i change word press URL WP-admin breaks. When i access example.com/blog/WP-admin it gives a 404 error.
I have tried replacing all the values in database dump file to example.com/blog. But it didn't help. Also tried to proxy all php file under wp-admin from example.com/blog/ to blog.example.com, Nothing worked.
Anyone can please suggest a solution here.?
Thanks
I cannot exactly know what you mean. Would you mind offering your configuration file here?
And I think your configuration file for nginx proxy would be the code below:
server {
listen 80;
server_name example.com;
location / {
# other configurations
}
location /blog {
rewrite . /blog/ redirect;
}
location /blog/ {
proxy_pass http://blog.example.com/;
# the '/' suffix in the url is important
proxy_set_header X-Forwarded-For $proxy_add_forwarded_for;
# and any other configs
}
}
Related
I'm doing a 301 redirect from old domains to the new domain but can't able to exactly make it work.
So just a TLD change and everything else is same.. Like URL
Old domain : https://donateers.com
New domain https://donateers.org
Here is the code I tried in the nginx file but got 503 error.
server {
. . .
server_name donateers.com;
rewrite ^/(.*)$ https://donateers.org/$1 permanent;
. . .
}
The site is using the easy engine stack
Thanks
Suresh
Solution:
The above code works, Just I need to add in the main.conf file
Just below the code of
server_name donateers.com;
I need to add the following 1 line of code to do the 301 redirect.
rewrite ^/(.*)$ https://donateers.org/$1 permanent;
We're making the redirection permanent here and every URL of old domain change to the new URL with 301 redirection. Even works with http, www version of donateers.com
After you add this.. You need to restart the start with the one line of command.
ee site restart donateers.com
EasyEngine makes it very handy.
use this
server {
listen 80;
listen 443;
server_name .donateers.com;
return 301 $scheme://donateers.org$request_uri;
}
I am running a wordpress docker container , the site is accessible through host machines port 8000 , if go to localhost:8000 boom i get to see my wordpress site.
It's boring to always type localhost:8000 to see my website, so i decided to commission nginx as a reverse proxy for my site. I've set up a virtual host in nginx that has the name proxy.site , i can now access by wordpress site by visiting http://proxy.site.
Up until this point, we are doing great, when http://proxy.site opens up, i can see a list of my blog posts, lets say i want to read my latest blog post about COVID-19 , when i click on the link, ohohohoho it opens up as http://localhost:8000/posts/covid19
I want it to open with the proxy url as in http://proxy.site/posts/covid19 , i need to whole site to be accessible through the http://proxy.site site name,
I need nginx to rewrite all my links in localhost:8000/* to proxy.site/* , no body loves typing ports when accessing a blog,
Here is how my nginx conf file looks like
server {
listen 80;
listen [::]:80;
root /var/www/proxy.site/html;
index index.html index.htm index.nginx-debian.html;
server_name proxy.site www.proxy.site;
location / {
proxy_pass http://localhost:8000;
#proxy_set_header HOST $host;
#proxy_redirect http://localhost:8000/ http://proxy.site/ ;
#try_files $uri $uri/ =404;
}
}
How do i achieve rewrite all urls in the proxied site with my custom host name ?
Nginx does not listen to localhost:8080, nginx will not inspect links from your site to rewrite them, you should find a way on WordPress to replace base url of your links.based on the environment
All, i'm running into issues proxying a subdomain to a DO space (suspect that AWS/S3 would act the same way); in this case, trying to serve logos off the bucket, with the requested url being logos.mysite.com/dev/logo1. Nginx should proxy_pass this to https://mybucket.dospace.com/logos/dev/logo1.png (and it will always be .png).
NGINX setup is currently:
server{
server_name logos.mysite.com
location / {
set $bucket "mybucket.dospace.com"
proxy_pass https://$bucket/logos$request_uri.png;
proxy_set_header Host $host;
... other proxy_set/hide settings ...
}
Above is simplest version of many rewrite/return/regex location attempts, but nothing works. In the example above (using chrome), a redirect to https://mybucket.dospace.com/dev/logo1.png occurs, which is missing /logos in the path. Moreover, I don't want chrome to redirect at all - it's more convenient for the user to see the original request from logos.mysite.com (if that's possible).
Was anyone able to execute on a similar setup?
Currently,
https:// example.com proxy_pass port 8080 via Nginx to : https:// example.com/app/index.py
Configuration file :
location / {
proxy_ignore_client_abort on;
proxy_pass https://ip_address_app:8080/;
/app/index.py is default loading page on application server.
Now, I would like to rewrite/ redirect or proxy_pass to non-default loading page from :
https:// example.com -- > Nginx --> https:// example.com/app/xyz.py
I have tried rewrite , proxy_redirect and proxy_pass but it didnot work as expect.
I dont have permission to change anything on app server.
Please advise.
Thank you,
Got an issue with URL rewrite under nginx. Actually I have a main domain name dns1.com which is pointing a webserver with a WordPress installation (permalink = /%category%/%postname%/). I've created this page dns1.com/forum/forumname1.
I also have a domain name forumname1.com and I want this one to be pointed to the content of dns1.com/forum/forumname1. The issue is that I don't know how to display the result of dns1.com/forum/forumname1 with only forumname1.com in the bar address :( Actually it works when I go to forumname1.com/forum/forumname1 but this URL is pretty redundant :/ I should make this parameter "/forum/forumname1" hidden but how?
Here is my nginx serverblocks :
server{
server_name dns1.com;
root /var/www/dns1.com;
location = /forum/forumname1 {
rewrite ^/(.*)$ http://forumname1.com permanent;
}
}
server{
server_name forumname1.com;
root /var/www/dns1.com;
location = / {
### Rewriting rule HERE but which one?
}
}
Thank you :)