首页 > nginx+laravel5.2只能访问Index控制器,无法访问其他控制器。

nginx+laravel5.2只能访问Index控制器,无法访问其他控制器。

大神门,我的服务器是centos7+nginx+laravel5,现在的问题是我的配置好后只能访问Index控制器,无法访问其他的文件,然后提示404错误。谁有经验或者知道怎么修改?请帮忙讲解一下。不胜感激。

下面是我这里的ngxin配置,大神门看看要是觉得哪里不对的帮忙指出来,最后能说说怎么修改比较好,先谢谢啦。

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

     fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;
fastcgi_read_timeout 300;

sendfile        on;
#tcp_nopush     on;

keepalive_timeout  65;

#gzip  on;

include /etc/nginx/conf.d/*.conf;

server {
    listen 80 default_server;
    server_name 101.200.76.215;
    root /var/www/phpmoo_online/phpmoo_blog/public;
    index index.php index.html index.htm;
    charset utf-8;

    location / {
       index index.php
       try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
            root /var/www/phpmoo_online/phpmoo_blog/public;
            try_files $uri /index.php =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME  /var/www/phpmoo_online/phpmoo_blog/public$fastcgi_script_name;
            include fastcgi_params;
    }
}

}


目测地址重写有问题,路由没法正确解析参数。

【热门文章】
【热门文章】