2017-08-20 11 views
0

これはnginxの設定です。ドメイン名はtstdmn、2つのlaravelプロジェクトは最初のtstdmn.comプロジェクトと2番目のfloristプロジェクトです。tstdmn.com/floristにfloristプロジェクトを展開します。 、私はそれをすべて設定しますが、それはtstdmn.com/floristで空白のページを返しますここで私の問題は何ですか?そして、私は、メインプロジェクトに花屋プロジェクトを切り替えるため、問題は私のnginxの構成である知っている、それはそのない私のlaravel構成から、のようなプロジェクトのショーの空白のNginx複数のプロジェクトが1つのドメインにある空白ページ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; 
    } 

それで別のルート/

を登録するに動作します
+0

あなたはプロジェクトフォルダに必要な権限を与えましたか?あなたがLinuxにいるなら、selinuxを無効にしてください – Mohsen

+0

@Mohsenはい私はフォルダに必要なすべての権限を与えました。 – Katerou22

答えて

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

関連する問題