Hi I'm create laravel for BackOffice and Api for frontend.
In frontend I use vuejs.
How to setup nginx
- if find path /admin -> enter to laravelproject
- if find path /api -> enter to laravel project
- else just enter in vue project
Here Is what I use now
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.php index.htm index.nginx-debian.html;
server_name localhost;
location / {
// Here is working fine run index.html ( vue )
try_files $uri $uri/ = /index.html;
}
location ~ \.php$ {
// setup php version
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location /api {
// I want to go in laravel path here. It's not working
root /var/www/html/serverside/public;
try_files $uri $uri/ /index.php?$query_string;
}
location /admin {
// I want to go in laravel path here.It's not working
root /var/www/html/serverside/public;
try_files $uri $uri/ /index.php?$query_string;
}
}
Here is my folder structure
/var/www/html/serverside/laravelproject ( in serverside laravel project locate here )
/var/www/html/index.html ( Here is vue js )
***** UPDATE *****
Here is my laravel.conf
server {
listen 80;
root /var/www/html/serverside/public;
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
nginx error.log show
/etc/nginx/sites-enabled/laravel.conf" failed (40: Too many levels of symbolic links) in /etc/nginx/nginx.conf:62
location ~ \.php$block inheritsroot /var/www/html;.