【发布时间】:2018-01-28 15:34:54
【问题描述】:
这是我的 Nginx 配置。我有一个名为 tstdmn 的域和两个 Laravel 项目第一个 tstdmn.com 项目和第二个 florist 项目我想将 florist 项目部署到 tstdmn.com/florist,我设置了所有内容,但它在 tstdmn.com/florist 返回一个空白页面我的问题在这里?!而且我知道问题出在我的 Nginx 配置上,因为我将花店项目切换到主项目并且它可以工作,它不是来自我的 Laravel 配置
root /var/www/html/tstdmn.com/public;
# Add index.php to the list if you are using PHP
index index.html index.php index.htm index.nginx-debian.html;
server_name tstdmn.com www.tstdmn.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
}
location ^~ /florist {
alias /var/www/html/florist/florist_backend/public;
try_files $uri $uri/ @laravel1;
location ~ \.php {
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(.*)$;
include /etc/nginx/fastcgi_params;
}
}
location @laravel1 {
rewrite /florist/(.*)$ /florist/index.php?/$1 last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
因此项目展示的另一条路径是空白,例如 /register
【问题讨论】:
-
您是否授予了项目文件夹所需的权限?如果您使用的是 linux,请禁用 selinux
-
@Mohsen 是的,我为该文件夹提供了所有需要的权限,当我将项目直接连接到它工作的域时,我提到了