环境:Lnmp(nginx+php+mysql)
今天在搭建Laravel框架的时候访问显示空白页:
解决如下:
cd laravel chmod -R 777 storage
在配置Laravel路由的时候报了404错误
首先分析下问题:一般出现这种情况的都是apache或者nginx配置出现问题
nginx解决办法
在location里面加上 try_files $uri $uri/ /index.php?$query_string;
如果配置文件中存在 try_files $uri $uri/ =404;需要将它注释掉或者删掉,否则会报错
鄙人的nginx配置如下:
worker_processes 1; events { worker_connections 1024; } http { include mime.types; # include /app/soft/nginx/conf/vhost/*.conf; default_type application/octet-stream; client_max_body_size 50m; client_header_buffer_size 50M; large_client_header_buffers 4 50M; log_format main '$server_name $remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for" ' '$ssl_protocol $ssl_cipher $upstream_addr $request_time $upstream_response_time'; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; send_timeout 60; location / { root /app/www/laravel/public; access_log /app/log/access.log; error_log /app/log/error.log debug; try_files $uri $uri/ /index.php?$query_string; index index.php index.html index.htm; } location ~ \.php$ { root /app/www/laravel/public; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffers 8 128k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; include fastcgi_params; } }
这样就ok了,现在可以开启你的laravel模式了~~
收藏了,赞赞。
不错~~~~~