Answer the question
In order to leave comments, you need to log in
How to set up NGINX subfolders for Laravel?
There is one server, it needs to host two Laravel projects.
server {
listen 80 default_server;
index index.php;
server_name _;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ^~ /media {
alias /var/www/html/public;
try_files $uri $uri/ @rewmedia;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME /var/www/html/public/index.php;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
}
location @rewmedia {
rewrite /media/(.*)$ /media/index.php?/$1 last;
}
location ^~ /handbook {
alias /var/www/handbook/public;
try_files $uri $uri/ @rewhandbook;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME /var/www/handbook/public/index.php;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
}
location @rewhandbook {
rewrite /handbook/(.*)$ /handbook/index.php?/$1 last;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question