Using this tutorial
http://rainbow-six3.com/plesknginx/ i am trying to redirect my name.com to ip:8080 , after that setup if i acces through name.con i get an redirection loop... is there any other service to redirect? Had a lot of problems with nginx.
I want to redirect name.com to an tomcat7 application wich uses ip:8080 to get executed. Tomcat is already an headache...
Neither this helped me:
Tomcat base URL redirection
It outputs webpage not available on link: http://name.com/index.jsp
Mind the words. 'Redirecting' != 'Proying'. You redirect through 301 or 302 to a publicly directly accessible resource, while you proxy to a backend, not supposed to be directly accessed.
The minimal configuration to proxy any name.com/<whatever> request to <ip>:8080/<whatever> is:
server {
listen 80;
server_name name.com;
location / {
proxy_pass $scheme://<ip>:8080;
}
}
Related
I just migrated my web app from a server that was using Apache to a new server using Nginx. Everything is fine, except for my API routes.
I'm testing with POSTMAN, and if I use https://www.example.com/api/example I just get a response with an empty "message" variable.
But if I use https://example.com/api/example, it works fine.
I have a mobile app pointing to the URL which includes WWW, and I don't want to make an update just to make this change. How can I make the route including WWW work again?
You need to change the host name in nginx config file to include www.
Sample:
server {
listen 80;
server_name example.org www.example.org;
...
}
I have couple of application one running on HTTPS(ssl.demo.com) and other application on HTTP(nossl.demo.com),here how my configuration for each application look like
https on application (https://gist.github.com/meetme2meat/572a1d8c70234d28d4e0)
http application (https://gist.github.com/meetme2meat/d6ce43d529f5a4e275a7)
Now as per what I see every redirection i.e (30x response code) cause the nginx to redirect it to the http application
Example : -
When on https://ssl.demo.com any 302 request(let say 302 to /path1 ) cause the nginx the redirect the above path to http://ssl.demo.com/path1 instead of https://ssl.demo.com/path1 (The problem is that although the domain look good without the scheme(http instead of https in above case) but the path is internally served by to nossl application instead of ssl)
Any Clue what need to be done over here ?
We are running Nginx as a proxy in front of a multi-tenant app hosted on IIS. When one of the tenants is down for maintenance I would like to redirect the url to a static web page hosted on AWS S3 or a local static page on the Nginx server.
For example the url may be http://demo.myapp.com, so would want demo to be redirected but anything else such as http://test.myapp.com to function as normal through the proxy pass to the back end web servers.
I have tried using rewrite / return in a new server block setting the server name to demo.myapp.com and this works redirecting to a static page but it redirects all not just demo.
All the traffic goes to port 80 on the Nginx server and the default location / then proxy to the back end web servers.
Looking for any advice on this as I am new to Nginx and cannot find an answer.
Thanks in advance.
Nginx external URL redirect
location ~* ^/example/(.*)$ {
rewrite ^ https://example.net$uri redirect;
}
hi i have nginx server and other webserver which i want to hide from public direct access. but when i try to access that server on root i send redirect response to client to url like this: server/test/spring/main. when i try to access it from nginx server i get the server url redirect instead nginx url.
example:
my-nginx.com
my-server.com
if i want to access myserver.com/test/spring/main from nginx server i guess i have to access my-nginx.com/test/spring/main but when i do that i get redirect to url myserver.com...
my config:
upstream my-server {
server my-server.com;
}
server {
listen 80;
server_name my-nginx;
location / {
proxy_pass http://my-server/;
}
}
the other think is when i access the root page on my-server.com i redirect the client to "https://my-server.com/test/spring/main".
Why i'm redirect from my-nginx.com url to my-server.com?
This configuration seems do not have big problem, and I also use proxy_pass to access other domain in our production environment, and do not redirect.
You should be care of the last '/' in "http://my-server/", usint "http://my-server" instead, or just using "http://my-server.com" with no upstream.
The behavior with '/' or with not '/' is a little different.
I'm new to nginx and am trying to figure out an issue with redirection. I'm trying to redirect a website from a host running a web application to another domain. That part I've done but I'm looking to mask it. When it redirects, I don't want the user to know they've gone to another domain.
I've substituted the domain names for privacy of my client. But, they are on a Linode at test.com that's running a web application that's at sub.test.com. All I want is for any user visiting test.com to be redirected to a temporary site hosted on other.com but without exposing the domain.
Previously, someone had shown me how to do it but it was a long time ago and I no longer have the information to reference. Can someone help me out? I don't want to expose the domain of the testing environment.
server {
listen 80;
server_name www.test.com test.com www.test.net test.net;
rewrite ^ http://other.com/sub redirect;
location / {
root /srv/http/www.test.com;
index index.html;
}
}
You can't do that with redirect, cause redirect is actually like telling the browser where to fetch page from, so you can't obscure the real location.
I guess what you need is proxying, e.g. a client requests some document from your server (test.com), then your server fetches the document from some other server (other.com) and returns that document to a client as if it was generated on test.com - it that case a client won't be able to determine where actually the document is originating from.
This can be done with:
server_name test.com;
location / {
proxy_pass http://other.com;
}
if you want the redirect to not change the user-visible domain name then you need to change it from a 301 to a 302 by changing your rewrite as follows:
rewrite ^ http://other.com/sub redirect;