Proxy_pass issue

Hey guys, first time poster. Struggling to get nginx to proxy_pass
through to another server.

Server 1: http://storecrowd.com/ (Nginx)
Server 2: http://storecrowd.com/blog/ (Nginx)

I’ve got nginx set up on server 1 to proxy_pass through to IP address
using:

location /blog/ {
proxy_pass http://74.207.242.38/
}

Visiting the blog url you can see that it does work. However all static
content on http://storecrowd.com/blog/ gives a 404 error & as such the
images aren’t working.

Is there a better way to do this, or are we missing something in the
proxy_pass?

Any help greatly appreciated!

Cheers
Stuart

On Mon, Oct 5, 2009 at 7:35 PM, Stuart M. [email protected]
wrote:

location /blog/ {
proxy_pass http://74.207.242.38/
}

Err, I think it’s due to the last slash above. Maybe removing that
slash and do a “rewrite” before “proxy_pass” to strip the leading
/blog/? Well, just a guess. I could be wrong :wink:

Cheers,
-agentzh

Try leaving the last / off of the /blog/. It would be written as
//blog/ if
I’m not mistaken.(please anyone correct me if I’m wrong)

On Tue, Oct 06, 2009 at 12:12:09AM -0600, Brian Henson wrote:

Try leaving the last / off of the /blog/. It would be written as //blog/ if
I’m not mistaken.(please anyone correct me if I’m wrong)

No, this proxy_pass replaces “/blog/” part in URI to “/”, i.e.
“/blog/page.html” will be “/page.html”.

On Mon, Oct 05, 2009 at 01:35:34PM +0200, Stuart M. wrote:

Hey guys, first time poster. Struggling to get nginx to proxy_pass
through to another server.

Server 1: http://storecrowd.com/ (Nginx)
Server 2: http://storecrowd.com/blog/ (Nginx)

Do you have two servers with the same ?

Is there a better way to do this, or are we missing something in the
proxy_pass?

Any help greatly appreciated!

It’s seems you need

location /wp-content/uploads/ {
proxy_pass http://74.207.242.38;
}

Igor S. wrote:

It’s seems you need

location /wp-content/uploads/ {
proxy_pass http://74.207.242.38;
}

Appreciate all the help so far guys :slight_smile: It’s been a tough one to figure
out.

The Proxy pass as you can see passes the URL through but images etc are
still not working so I’ve set things to just load from the IP address in
the meantime.

The problem with that is there’s a duplicate copy of the blog on
http://74.207.242.38/

I’ve tried:

location /wp-content/uploads/ {
    proxy_pass http://74.207.242.38;
}

and

location /blog/wp-content/uploads/ {
    proxy_pass http://74.207.242.38;
}

With no success so far, still getting the 404 errors on the pages.

It’s a tricky one I know!

Cheers
Stuart

Igor S. wrote:

What is in error_log corresponding to these 404 errors ?

2009/10/05 13:24:50 [error] 14562#0: *4 open()
“/usr/local/nginx/html/wp-content/uploads/2009/04/wpshop.jpg” failed (2:
No such file or directory), client: 78.21.193.90, server: _, request:
“GET /wp-content/uploads/2009/04/wpshop.jpg HTTP/1.1”, host:
“74.207.242.38”, referrer:
http://storecrowd.com/blog/wordpress-ecommerce/

Directory should be /var/www/blog/wp-content/uploads/

I haven’t specified in either config file though that anything exists in
/usr/local/nginx/html which is strange.

Getting Closer :slight_smile:

Cheers
Stuart

On Tue, Oct 06, 2009 at 02:35:57PM +0200, Stuart M. wrote:

    proxy_pass http://74.207.242.38;
}

and

location /blog/wp-content/uploads/ {
    proxy_pass http://74.207.242.38;
}

With no success so far, still getting the 404 errors on the pages.

What is in error_log corresponding to these 404 errors ?

On Tue, Oct 06, 2009 at 03:11:31PM +0200, Stuart M. wrote:

Directory should be /var/www/blog/wp-content/uploads/

I haven’t specified in either config file though that anything exists in
/usr/local/nginx/html which is strange.

Getting Closer :slight_smile:

"/usr/local/nginx/html’ is default root. Probably, you need to set

server {
root /var/www/blog;

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs