free9 发表于 2015-1-22 21:59:27

joomla3.2 nginx下伪静态 404错误

在joomla 官网上下载了nginx 伪静态规则,修改了文件 /usr/local/nginx/conf/vhost/xxx.conf
重启nginx 后 除开网站首页其他页面都是404错误。https://docs.joomla.org/Nginx


server {
listen 80;
server_name YOUR_DOMAIN;
server_name_in_redirect off;

access_log /var/log/nginx/localhost.access_log main;
error_log /var/log/nginx/localhost.error_log info;

root PATH_ON_SERVER;
index index.php index.html index.htm default.html default.htm;
# 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;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi.conf;
}

# caching of files
location ~* \.(ico|pdf|flv)$ {
expires 1y;
}

location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
expires 14d;
}

}




请各位看下规则是否有问题

licess 发表于 2015-1-23 08:39:53

他们官网给你的是一个完整的虚拟主机配置,你看一下配置里的注释就明白了
# Support Clean (aka Search Engine Friendly) URLs
开始是伪静态
# deny running scripts inside writable directories
开始是一些可执行文件的屏蔽

free9 发表于 2015-1-23 15:12:59

是不是只要这一段就可以了呢?

root PATH_ON_SERVER;
index index.php index.html index.htm default.html default.htm;
# Support Clean (aka Search Engine Friendly) URLs
location / {
try_files $uri $uri/ /index.php$args;
}

licess 发表于 2015-1-23 20:28:39

# Support Clean (aka Search Engine Friendly) URLs下面的

#2应该说的很清楚了
页: [1]
查看完整版本: joomla3.2 nginx下伪静态 404错误