所以,我试图找出Laravel。我将它安装在Nginx服务器上并更改了配置文件 - 我将其粘贴在下面。但是,当我访问该网址时,它会向我显示Index of /
这样的网页:http://imgur.com/JQiBmz4
server {
server_name website.com www.website.com;
root /var/www/website.com/htdocs/;
index index.php index.html;
#browse folders if no index file
autoindex on;
# serve static files directly
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
# removes trailing slashes (prevents SEO duplicate content issues)
if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$1 permanent;
}
# enforce NO www
if ($host ~* ^www\.(.*))
{
set $host_without_www $1;
rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
}
# canonicalize codeigniter url end points
# if your default controller is something other than "welcome" you should change the following
if ($request_uri ~* ^(/lobby(/index)?|/index(.php)?)/?$)
{
rewrite ^(.*)$ / permanent;
}
# removes trailing "index" from all controllers
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
# catch all
error_page 404 /index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/php.socket;
fastcgi_index index.php;
#include fastcgi_params;
include /etc/nginx/fastcgi_params;
}
}
答案 0 :(得分:3)
我没有使用nginx,但根据您的屏幕截图,您似乎没有正确设置网络根文件夹。如果我正确地阅读了该配置文件,您可以将您的网络根设置为
/var/www/website.com/htdocs/
如果您想将其设置为
/var/www/website.com/htdocs/public
也就是说,库存Laravel应用程序附带的public
文件夹应该是Web服务器看到的文件夹。其他文件夹应不可通过网络访问。
答案 1 :(得分:0)
@ User183849481
在您的nginx conf中将fastcgi_pass unix:/tmp/php.socket;
更改为fastcgi_pass 127.0.0.1:9000;
。
这将解决您的问题,因为nginx Web服务器无法将请求传递给php处理器。
它显示空白屏幕。