mardi 31 octobre 2017

laravel nginx different roots to different projects

I have global project (web wrapp) and multiple projects. Structure of files

project/
  application/
  index.php
    project1/
    project2(on laravel)/
      public/
        index.php

So, if i call project, i get index.php. I want to run project2/public/index.php with url /project2. nginx conf below:

server {
  listen 80 default_server;
  listen [::]:80 default_server;

  root /home/user/projects/project/application;
  index index.php index.html index.htm;

  location /project2/ {
    root /home/user/projects/project/application/project2/public/;
    try_files $uri $uri/ /index.php$is_args$args;
  }

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    fastcgi_read_timeout 600;
  }
}

With this configuration I get nginx's 404 when ask /project2. If I replase

location /project2/ {
  root /home/user/projects/project/application/project2/public/;
  try_files $uri $uri/ /index.php$is_args$args;
}

with

location /project2/ {
  root /home/user/projects/project/application/project2/public;
  try_files $uri $uri/ /project2/public/index.php$is_args$args;
}

I get Not found from Laravel. Is it possible to solve my problem?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2gQ58Wc
via IFTTT

Aucun commentaire:

Enregistrer un commentaire