百度上搜到的Joomla的nginx伪静态规则很多都是错的,其实Joomla官方已经提供正确的规则,如下
代码中只有前一个location是伪静态规则,此规则适合2.5.x和3.x版本。
# Support Clean (aka Search Engine Friendly) URLs location / { try_files $uri $uri/ /index.php?$args; } # deny running scripts inside writable directories location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { return 403; error_page 403 /403_error.html; } # caching of files location ~* \.(ico|pdf|flv)$ { expires 1y; }