joomla程序在lnmp/nginx中默认是没有配置文件的,不像dede,wordpress等开源程序都有现成的conf配置文件,直接在网站配置文件里include一下就可以了。
如果你的网站是IIS或者apache,可以参考:http://www.vuln.cn/?s=%E4%BC%AA%E9%9D%99%E6%80%81
网上关于joomla伪静态的配置有几个,但是都是千篇一律,且是不能用的。
比如:
核心伪静态实际上就这一句:
location / {
try_files $uri $uri/ /index.php$args;
}
实测用不了。
建议大家还是不要图省事直接在网站配置文件里加一两句就行了,还是要在/usr/local/nginx/conf下建一个conf伪静态配置文件,如:joomla.conf,内容如下:
if ( $args ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3d)" ) {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;}
if ( $args ~ "base64_encode.*\(.*\)") {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;}
if ( $args ~ "(\|%3E)") {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;}
if ( $args ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})") {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;}
if ( $args ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})") {
set $args "";
rewrite ^.*$ http://$host/index.php last;
return 403;}
if (!-e $request_filename) {
rewrite (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ /index.php last;
break;
}
然后在网站的配置文件中引用一下:
include joomla.conf
然后到/usr/local/nginx/sbin下
./nginx -s reload #重启一下即可
至此,完美,没毛病。



云悉指纹