Help for nginx proxy pass rule

Roni Baby roni at citrusinformatics.com
Wed Apr 6 10:44:50 UTC 2016


HI,

 

We have a WordPress site named it as https://www.abc.com; We are using Nginx
as the web server for this site. I wanted to create a proxy pass rule like
this

 

https://www.abc.com/static/js/widget.js will be load from
https://www.xys.org/static/js/widget.js without changing URL

 

Here is the configuration that I configured for this requirement in the
www.abc.com Nginx site configuration file

 

location /static {

        proxy_pass      https://www.xys.org/static;

        proxy_set_header Host  www.xys.org;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header X-Forwarded-Proto $scheme;

}

 


When I access https://www.abc.com/static/js/widget.js,  I am getting Nginx
404 Not Found error with the following error log in its log file


2016/04/06 06:39:14 [error] 20107#0: *907 open()
"/usr/share/nginx/html/www.abc.com/static/js/widget.js" failed (2: No such
file or directory), client: 118.102.223.138, server: www.abc.com, request:
"GET /static/js/widget.js HTTP/1.1", host: www.abc.com


I have tried different Nginx proxy pass configuration but not success yet.
It will be good to get your thought to fix this issues


Thanks


Roni


 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160406/e530fe40/attachment.html>


More information about the nginx mailing list