joomla3.6.5 nginx下 前台页面404错误

正常安装 joomla3.6.5后 后台可以打开 前台页面404 百度后发现是没有配置 nginx的伪静态规则  joomla官方提供了配置文件 地址:http://docs.joomla.org/Nginx  配置如下:

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;
        }

}

伪静态规则在于 try_files $uri $uri/ /index.php?$args;  这句话 加入后重启nginx 前台页面正常了  我的nginx配置如下:

server {
    listen       80;
    server_name  xxxxx.xxxx.org;
    charset utf-8;
    access_log  /www/log/xxxxx.xxxx.org.log  main;

    location / {
        root /www/xxxxx.xxxx.org;
        index index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$args;
    }

    error_page 500 502 503 504  /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
    
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME /www/xxxxx.xxxx.org$fastcgi_script_name;
        include        fastcgi_params;
    }

     location ~ \.(less|sql)$ {
        deny all;
    }
}




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值