nginx的"common pitfalls"描述表明这很糟糕:
server {
root /var/www/example.com;
location / {
if (!-f $request_filename) {
break;
}
}
}
......应该用这个代替:
server {
root /var/www/example.com;
location / {
try_files $uri $uri/ /index.html;
}
}
但是我怎么能在这种情况下消除if:
if (-f $request_filename) {
break;
}
if (!-f $request_filename) {
proxy_pass http://localhost:8080;
break;
}