i have tried to redirect to php and node.js from nginx. this is my nginx code
server {
listen 8060;
server_name mydomain;
access_log /var/log/nginx/mydomain.log;
location /
{
proxy_pass http://mydomain;
}
location /node {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://mydomain/;
proxy_redirect off;
}
}
when i run localhost:8060 in browser it is redirecting to localhost:70. from here added /index.html in browser it is showing that html page.i have written on ajax call within that html page. so when i click submit button ajax will be called and then send request to php and getting response from php within success function of ajax.it is working fine.and then again i am redirecting to nginx from that success function itself this is that code
$.ajax(
{
url:"service/lpage.php",
type:"GET",
contentType: "application/json",
dataType:'json',
data:{"uname":user,"password":pass},
success:function(data)
{
if(data.token)
{
window.location="http://mydomain:8060/node?token="+data.token;
}
},
error: function(data,statusCode) {
alert('Error ' + statusCode);
}
});
again i am redirecting to node.js from nginx by using this proxy_pass 127.0.0.1:4000/; yes it is redirect but when it is redirecting to node.js i am rendering one html .so js and css files are in localhost:4000 but it is seeking that library 127.0.0.1:8060 so i am getting Not found error in my firebug.how to resolve this?