这是我在nginx的配置我有域名tstdmn和两个laravel项目第一个tstdmn.com项目和第二个花店项目我想将花店项目部署到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
答案 0 :(得分:0)
我在laracasts的解决方案中解决了这个问题: 使用子域而不是路由
server { listen 80; listen [::]:80;
root /var/www/html/florist/florist_backend/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 florist.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;
}
.....和一些无关的代码
laracast https://laracasts.com/discuss/channels/servers/nginx-multiple-projects-in-one-domain-errors
中的问题地址