Skip to content

Instantly share code, notes, and snippets.

@fcaldarelli
Created February 16, 2024 17:56
Show Gist options
  • Save fcaldarelli/9ef1a8f8aa42e2786008554ff183e2c5 to your computer and use it in GitHub Desktop.
Save fcaldarelli/9ef1a8f8aa42e2786008554ff183e2c5 to your computer and use it in GitHub Desktop.
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/top/public;
index index.html index.htm index.php;
server_name _;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location /nested {
alias /var/www/nested/public;
try_files $uri $uri/ @nested;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
location @nested {
rewrite /nested/(.*)$ /nested/index.php?/$1 last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment