February 2018
Beginner to intermediate
348 pages
9h 40m
English
In order to establish this separation, we can simply use two different location blocks: one that will match the dynamic file extensions, and another one encompassing all the other files. This example passes requests for .php files to the proxy:
server {
server_name .example.com;
root /home/example.com/www;
[...]
location ~* .php.$ {
# Proxy all requests with an URI ending with .php*
# (includes PHP, PHP3, PHP4, PHP5...)
proxy_pass http://127.0.0.1:8080;
}
location / {
# Your other options here for static content
# for example cache control, alias...
expires 30d;
}
}
This method, although simple, will cause trouble with websites using URL rewriting. Most Web 2.0 websites now use links that hide file extensions, such as ...
Read now
Unlock full access