user87267867
user87267867

Reputation: 1419

ngnix location directive not working

I have a below sample url format

http://test.example.com:3000/samp/value?AP=API&SE=AU

where value is dynamic

Below is my ngnix config file

#pid        logs/nginx.pid;
events {
worker_connections  1024;
}
http {
# HTTPS server                                                                            

upstream node_entry {
server test.example.com:3000
}                                                                               
server {
listen       443;   
ssl                  on;
ssl_certificate      /etc/ssl/certs/myssl.crt;
ssl_certificate_key  /etc/ssl/private/myssl.key;
server_name  domainname;
location / {
    #root   html;
    #index  index.html index.htm;
    return 503;
}
location /samp {
    proxy_pass   node_entry;
}
}

}

When I hit http://test.example.com/samp/value?AP=API&SE=AU I get an error saying Cannot get

/samp/value?AP=API&SE=AU. What Im doing wrong here.

Any help on this will be really helpful

Thanks,

Upvotes: 1

Views: 128

Answers (1)

lexa
lexa

Reputation: 29

Change

proxy_pass   node_entry;

to

proxy_pass   https://node_entry;

For configuration tests you can run nginx -t and get some like

nginx: the configuration file conf/nginx.conf syntax is ok
nginx: configuration file conf/nginx.conf test is successful

Or

nginx: [emerg] invalid URL prefix in conf/nginx.conf:26
nginx: configuration file conf/nginx.conf test failed

Upvotes: 1

Related Questions