I wrote a training application: backing up on java (Spring boot), and the front on angularjs. Now I’m trying to start the application, Tomkat runs on port 8080. I’ve got some questions with configuring the nginxb config. I don’t understand how to set the path to the compiled front. Nginx config:

#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root C:\projects\meteorep\meteorep-front\html; index C:\projects\meteorep\meteorep-front\index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } } 
  • proxy pass is necessary - zb '
  • Added proxy_pass 127.0.0.1 ; However, the application does not start - Sam Kilanoff
  • The port is not specified - zb '
  • Added port 8080, it still does not start - Sam Kilanoff

1 answer 1

You can use nginx as a proxy.

 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; # дальше всякая шелуха по поводу размеров всяких буфферов, таймаутов proxy и т.п. } } 

  • I truly understand that it should look like this: location / {root C: \ projects \ task-manager-master \ task-manager-master-front \ html; index C: \ projects \ task-manager-master \ task-manager-master-front \ index.html index.htm; proxy_pass 127.0.0.1:8080 ; # my java server port 8080 proxy_redirect off; } But in this version it still does not start .. - Sam Kilanoff