【发布时间】:2017-11-06 07:13:02
【问题描述】:
我使用的是 Ubuntu 16.04。这是我的虚拟主机配置。我从
编辑了我的根文件夹/var/www/example.com/public_html/mysite/public
到
/var/www/example.com/public_html
然后我为子目录配置了我的 vitualhost,如下所示。网站只显示白屏。错误日志,nginx错误日志为空。
server {
listen 80;
#listen [::]:80 default_server ipv6only=on;
root /var/www/example.com/public_html;
index index.php index.html index.htm;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
error_log /var/www/logs/error.log;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ^~ /mysite {
alias /var/www/example.com/public_html/mysite/public;
try_files $uri $uri/ @mysite;
location ~* \.php {
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
}
}
location @mysite {
rewrite ^/mysite/(.*)$ /mysite/index.php?/$1 last;
}
}
我不知道是什么问题。
1) 文件权限,laravel 配置已正确完成。
2) 我认为问题出在 php fpm。但它可以,打开没有子目录的网站
我之前在 Ubuntu 14.04 中做过同样的事情。看来,在 Ubuntu 16.04 中存在一些差异。另外,我检查了我的 public/index.php,在那里添加了 die() 函数和消息。但是,又是白屏。也许,我在配置 Nginx 时错过了什么?
【问题讨论】: