404 - nginx+laravel5.2 can only access the Index controller and cannot access other controllers.
ringa_lee
ringa_lee 2017-05-16 16:54:14
0
1
608

Dashenmen, my server is centos7+nginx+laravel5. The problem now is that after I configure it, I can only access the Index controller, but cannot access other files, and then it prompts a 404 error. Does anyone have experience or know how to modify it? Please help explain. Greatful.

The following is my ngxin configuration here. If you feel something is wrong, please help me point it out. Finally, I can tell you how to modify it better. Thank you in advance.

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

}

ringa_lee
ringa_lee

ringa_lee

reply all(1)
过去多啦不再A梦

Visual inspection shows that there is a problem with address rewriting, and the routing cannot correctly parse parameters.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!