What I'm trying to do is enable a secondary site (and code) off a main site (different code) on the same nginx deployment and domain.
Main Site: Works as expected
Main example.com
Location Site 1: example.com/skunk
Location Site 2: example.com/frog
Location Site x: example.com/buffalo
Laravel / PHP
It's own bitbucket repository (main)
Other Page Site: Works as expected
example.com/information
Vue
It's own bitbucket repository (information)
Landing Page Site:
example.com/skunk/lander
Vite
It's own bitbucket repository (lander)
Issues:
Doesn't completely render the location, when hardcoding a location site (skunk,frog,buffalo)
Trying to make this dynamic, based on url passed foobar.com/Dynamic/lander
Configuration
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name foobar.com;
root /home/forge/foobar.com/current/public;
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/foobar.ilovekickboxing.com/server/*;
####################
## Works as expected
####################
location /information {
alias /home/forge/information.example.com/current/dist/;
index index.html;
try_files $uri $uri/ /index.html?query_string;
}
####################
## Doesn't completely render the location
## Hard Coded a specific location
####################
location /skunk/lander {
alias /home/forge/lander.example.com/current/dist/;
index index.html;
try_files $uri $uri/ /index.html?query_string;
}
####################
## Trying to make the location parameter dynamic so it will work for all locations (skunk,frog,buffalo)
####################
location ~* \(lander)$ {
alias /home/forge/lander.example.com/current/dist/;
index index.html;
try_files $uri $uri/ /index.html?query_string;
}
####################
## Works as expected
####################
location / {
try_files $uri $uri/ /index.php?$query_string;
}
access_log /var/log/nginx/example.com-access.log access;
access_log on;
error_log /var/log/nginx/example.com-error.log error;
location ~ \.php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
error_page 404 /index.php;
location ~ /\.(?!well-known).* {
deny all;
}
}