Proxy_pass remote nginx server

Hi,

i have 2 nginx server, one with my main site(www.site.com) and other
nginx
server with my blog(www.site2.com).

My nginx server 1 have this configurarion: on location /blog/ i have a
(proxy_pass) to blog on nginx server 2

*==========
server {
server_name www.site.com;
root “/home/site/site.com”;

index index.php;
client_max_body_size 10m;

access_log /home/site/_logs/access.log;
error_log /home/site/_logs/error.log;

location /blog/ {
proxy_pass http://www.site2.com/;
}
location / {
try_files $uri $uri/ /index.php$uri?$args;
}
location ~ “^(.+.php)($|/)” {
fastcgi_split_path_info ^(.+.php)(.*)$;

      fastcgi_param SCRIPT_FILENAME 

$document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SERVER_NAME $host;
fastcgi_read_timeout 120;
fastcgi_pass unix:/var/run/site_fpm.sock;
include fastcgi_params;
}

location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {

expires max;

# log_not_found off;

access_log off;

}

location ~* .(html|htm)$ {

expires 30m;

}

location ~* /.(ht|git|svn) {
deny all;
}
}
*==========

Nginx server 2 (blog) config

*==========

server {
server_name www.site2.com;
root “/home/site2/www.site2.com”;

index index.php;
client_max_body_size 10m;

    access_log /home/site2/_logs/access.log;
    error_log /home/site2/_logs/error.log;



    location / {
                    try_files $uri $uri/ /index.php$uri?$args;
    }


         location ~ "^(.+\.php)($|/)" {
            fastcgi_split_path_info ^(.+\.php)(.*)$;

            fastcgi_param SCRIPT_FILENAME

$document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SERVER_NAME $host;
fastcgi_read_timeout 120;
fastcgi_pass unix:/var/run/site2_fpm.sock;
include fastcgi_params;
}

    location ~* /\.(ht|git|svn) {
            deny  all;
    }

}

*==========

When i try www.site.com/blog/ proxy_pass works, go to nginx server 2 ,
and
my css/js are loaded fine. But when try www.site.com/blog/wp-admin/ is
redirected to www.site.com/blog/wp-login.php (on server 1) 404 error(i
dont
have this file in server 1).

how i can solve this? all www.site.com/blog/* trafic go to proxy_pass on
nginx server 2 www.site2.com/* ?

thanls

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,245606,245606#msg-245606

On Tue, Dec 17, 2013 at 12:18:00PM -0500, hussan wrote:

Hi there,

location /blog/ {
location / {
location ~ “^(.+.php)($|/)” {
location ~* /.(ht|git|svn) {

When i try www.site.com/blog/ proxy_pass works, go to nginx server 2 , and
my css/js are loaded fine. But when try www.site.com/blog/wp-admin/ is
redirected to www.site.com/blog/wp-login.php (on server 1) 404 error(i dont
have this file in server 1).

how i can solve this? all www.site.com/blog/* trafic go to proxy_pass on
nginx server 2 www.site2.com/* ?

http://nginx.org/r/location

You want ^~

f

Francis D. [email protected]

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