Home nginx NGINX + Java

NGINX + Java

Author

Date

Category

I organize a bundle: HTML & LT client; —- & gt; | NGINX & LT; – & gt server; Java server |

How to configure the nginx ‘config so that it can work in a bundle with a java server? On the Internet, I did not find anything about this (


Answer 1, Authority 100%

You can use NGINX as proxy. For example, something like this

Server {
  LISTEN 80;
  server_name myserver.ru;
  access_log logs / host.Access.log Main;
  location / {
    proxy_pass http://127.0.0.1:8080/; # my java server port 8080
    proxy_redirect off;
    # Further every husk about the size of all sides of the buffers, Taimauts Proxy, etc.
  }
}

UPD in the dogonka you can see a more detailed description on the site nginx: Java Servers Like Jetty, GlassFish and Tomcat


Answer 2

You can do similarly to the PHP sections and redirect requests for .jsf files to your Java server. Accordingly, it is better to connect them through UNIX sockets, if possible.
Naturally, this option would be better. Because In case of simple proximation, NGINX is good, but does not reveal its capabilities. At a minimum, it is better to divide statics with Java to different directories and static to charge NGINX, and Java files to transmit to the Java processing server.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions