路由规则不生效
location / {
try_files $uri $uri/ /index.php?$query_string;
}
已经在站点中配置了如下
server {
listen 80;
server_name 106.14.205.72;
access_log /data/wwwlogs/106.14.205.72_nginx.log combined;
index index.html index.htm index.php;
root /data/wwwroot/fange;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
#include /usr/local/nginx/conf/rewrite/laravel.conf;
#error_page 404 /404.html;
#error_page 502 /502.html;
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
}但访问过程除了/外的路由必须带index.php
http://106.14.205.72/blog2/public/basic1 结果File not found.
http://106.14.205.72/blog2/public/? 这个能访问出现laravel的welcom视图
Route::get('/', function () {
return view('welcome');
});
Route::get('basic1',function(){
return 'hello world2';
});