【发布时间】:2015-02-17 06:06:10
【问题描述】:
我遇到了一个问题,当我转到 /public 目录时,它会正常显示 Laravel 应用程序,但导航到任何其他页面会导致它显示
没有指定输入文件。
我正在使用带有 PHP 5.5.9 FPM 的 Nginx 服务器。
在过去的 4 个小时左右,我搜索了谷歌,查看了 Laravel 中重写问题的每个教程和 stackoverflow 页面,但是它们都产生了相同的结果。
我什至将所有文件和文件夹设置为 777,这样我就可以查看是否是某种权限问题。我检查了 Laravel 配置,一切就绪,我不知道出了什么问题。
谁能指出我正确的方向?
我尝试的最后一个配置如下:
server {
listen 80 default_server;
root /usr/share/sites/base;
index index.php
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
}
我还尝试了很多其他方法,例如:
server {
listen 80;
server_name domain.com;
root /usr/share/sites/base;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~* \.php$ {
# Server PHP config.
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
【问题讨论】: