Hot answers tagged

3

Your two server blocks will always conflict such that the first observed server block in the configuration file will be taking precedent as the default server block for all requests, unless you specify a proper server_name for each config to apply to incoming requests for that hostname / subdomain. (This applies also for all requests of which a requested ...


2

I would start with setting your nginx log to debug and then check to see where the request throws the 503 server { #other config error_log /var/logs/nginx/example.com.error.log debug; #other config }


1

Or you simply assign a fixed port in the reserved port range and grant your application the rights to bind to that port. sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/application


1

http{ ... server { listen 80; server_name api.example.com; #charset koi8-r; access_log logs/api.example.com.access.log combined; location / { proxy_set_header X-Real-IP $remote_addr; proxy_pass http://servername1; root path1; } } server { listen 80; server_name ...


1

It's become default behaviour starting since version 1.9.13 To change it back manually you can use: proxy_next_upstream error timeout non_idempotent;


1

The problem with what you're trying is that it you're treating the entire configuration as though it were constantly being parsed and interpreted at runtime, which of course is not the case. Certain arguments to the various directives are static, others dynamic, but server declarations are most definitely static. A server represents exactly one target ...


1

Don't expose the Tomcat server directly to the Internet. Put the web server into a DMZ (ie behind a firewall), then put the Tomcat server behind another firewall. You can use software firewalls provided by the operating system, or hardware firewalls, but you haven't said what OS you're using so I can't give more advice. Something like IPTables or Windows ...


1

For the purpose of the question I'll assume that the following IPs Nginx 192.168.0.1 Tomcat 192.168.0.2 Configure the tomcat server Change the following line address="127.0.0.1" to address="192.168.0.2" - This will tell Tomcat to listen on the local ip rather then the loopback address. Then we want to configure the IPtables. I used the generator ...


1

Make sure your proxy from Nginx is going to "127.0.0.1" instead of your server's / site's hostname or IP. If this is done, you could have an issue with the Tomcat connector being on IPV4 (forced by 127.0.0.1) while Nginx is trying to get to it on the IPv6 stack.


1

If nginx is running, but cannot connect to its upstream server, e.g., to tomcat, then you'd be getting a 50x-style error, NOT a connection refused one. Browser reports site refused to connect. ERR_CONNECTION_REFUSED – Chethan S. Apr 21 at 15:34 This means that you cannot connect to nginx in the first place. Are you sure it is running? Best way to ...



Only top voted, non community-wiki answers of a minimum length are eligible