I am new to Nginx and I need your help,
According to many forums I understood that all our static pages are stored in Nginx. When there is request comes I have to pass that request to tomcat for data and after response from tomcat response generated.
Currently, I have just done that I request directly passed to tomcat and respond to request. but I think that is not solution for performance.
So anyone can Help me?
You can using proxy_pass mapping to your tomcat server port, for example : if your tomcat port is 8080, your conf/nginx.conf should be configured like this:
...
http {
...
server {
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
restart it sbin/nginx -s reload, then when you can access http://127.0.0.1
, the request forward to tomcat.
Configuration file is placed commonly under:
/etc/nginx/nginx.conf