joomla搬家之后打不开 首页404错误

joomla 安装好之后, 网站打不开,首页404错误,后台能够正常访问,数据库连接正常。应该是 nginx配置的问题。该如何修改配置呢?
随便一个链接点进去都是404,找不到页面,
URL的形式如下:

http://www.xxx.com/index.php/getting-started

baidu出来的东西就不提了,乱七八糟的。

http://docs.joomla.org/Nginx#Configure_Nginx

看这里吧。

重要的一句:


location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
 

作死!
 

在location / {
}

里面加入一行

try_files $uri $uri/ /index.php?q=$uri&$args;

然后重启nginx。

 

传送门:https://docs.joomla.org/Nginx#Configure_Nginx

如何配置nginx 内容如下:

Configure Nginx

nginx configuration files reside in:

  • /etc/nginx/sites-available/ on Ubuntu (for sites running on that nginx instance)
  • /etc/nginx/nginx.conf on Gentoo and Raspbian(= Debian optimized for Raspberry Pi)

Here is an sample nginx configuration file, joomla.conf, that you can reuse over all your nginx enabled-sites.

server {
        listen 80;
        server_name YOUR_DOMAIN;
        server_name_in_redirect off;

        access_log /var/log/nginx/localhost.access_log;
        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;
        }

}

Pay attention to a few things:

  1. The parameter fastcgi_pass is set to 127.0.0.1:9000, corresponding to the port that fpm is configured to listen to. This means you can run the PHP processes on separate servers. On Gentoo, you can find this configuration in /etc/php/fpm-php5.3/php-fpm.conf/
  2. Don't forget to replace YOUR_DOMAIN & PATH_ON_SERVER above depending on your domain and the path of Joomla on your server.

posted on 2015-05-26 13:53  探灵档案  阅读(1032)  评论(0编辑  收藏  举报

导航