Hello,
I want to ask a question about what I to use proxy_pass or rewrite and
how
to use them. Basicly I want to redirect connection to internal server
for
example if user hit: www.mydomain.com/admin/ nginx to redirect all
requests
to http://192.168.1.1/.
But I got Error from http://192.168.1.1 admin does not exists. What I to
do
to redirect all requsts after /admin on web server to internal server
with
admin ?
But I got Error from http://192.168.1.1 admin does not exists. What I to do
to redirect all requsts after /admin on web server to internal server with
admin ?
Thank you,
one step forward but now I receive error 502 bad gateway. Server mydomain.com have 2 Ethernet. First one with realip that I connect,
second
one with virtual 192.168.1.2 connected to internal network. I don’t want
to
add in my fw redirect rule, so I expect to do it over the web. When I
access
realip or domain name in that directory, I actually to see the web of my
internal server located somewhere in local network.
one step forward but now I receive error 502 bad gateway. Server mydomain.com have 2 Ethernet. First one with realip that I connect, second
one with virtual 192.168.1.2 connected to internal network. I don’t want to
add in my fw redirect rule, so I expect to do it over the web. When I access
realip or domain name in that directory, I actually to see the web of my
internal server located somewhere in local network.
On Tue, Oct 30, 2012 at 07:33:14AM -0400, hristoc wrote:
Hi there,
I get real html from internal server with curl and is exact what I expect.
So: when you do “curl -0 -i http://192.168.1.1/” from the nginx server,
you get the same content as when you do “curl -i http://public-ip/admin”
from somewhere on the internet?
That suggests that the proxy_pass is working.
For example if I try to access direct js file over the
web like: http://www.mydomain1.com/server1/js/jsquery.js I get error 404
file not found. I think nginx does not forward this request to internal
serve and trying to find the js file on local directory.
How to resolve this issue ?
What is your nginx configuration?
In particular: what “location” blocks do you have?
Module ngx_http_core_module for details. My guess is that you have
something like “location ~ js” as well as “location /admin”, and nginx
chooses that location block for this request.
If that is true, then possibly using “^~” will work for you.
Thank you,
I resolve the problem. My knowledge on nginx is little and I unable to
redirect all js, html to their locations and I did not spend much time
for
that, but your answer give me idea that probably something in my
configuration making nginx to look for these files in different places
ie
some logic in my config is wrong. I added new virtual host name in nginx
and
proxy_pass everything to internal ip and everything is work perfect.
Thank
you for your time.
Here is my configuration if some one looking for some similar. With this
I
redirect web from internel hp iLO web port to external web.
HTTPS server
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name virt.domain1.com;
I get real html from internal server with curl and is exact what I
expect.
Over the nginx I fix the problem with bad gateway, but the problem that
I
now see: nginx does not access remote directories after / for example:
https://www.mydomain.com/server1 I see the html page, but if I organize
my
page with jquery for example and is included from different directory
js/jquery.js I see is not loaded in html ie nginx does not sub
directories,
only top level dir. For example if I try to access direct js file over
the
web like: http://www.mydomain1.com/server1/js/jsquery.js I get error 404
file not found. I think nginx does not forward this request to internal
serve and trying to find the js file on local directory.
How to resolve this issue ?
Posted at Nginx Forum:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.