Using Nginx as Webserver and Reverse proxy
Basically nginx is proxy server. Its capabilities include proxy HTTP, HTTPS, IMAP, POP3, SMTP and other protocols. For HTTP(S) proxy, the backend can be either FastCGI server like PHP-FPM or another web server.
For FastCGI backend like you need fastcgi module. For example, you need to define the backend with fastcgi_pass
. For proxying another website, you need HTTP proxy module. You need to use direction like proxy_pass
, proxy_cache
to control the behaviour of this module.
- Do I need to add to the same configuration file the proxy_pass, proxy_cache, etc.. configurations?
YES
- Do I need to set a configuration for a specific routes? or to disable them?
For example, you need proxy the the specific URL www.example.com/myawesomeapp
, then use location to match the URL
location /myawesomeapp {
proxy_pass http://<upstream_block_name>;
... other parameter ...;
}
- If for example if I don't want the route /app_dev.php/abc to be cached? what do I need to do?
Use proxy_cache_bypass. You can set by if
directive like this tutorial.