Welcome! Log In Create A New Profile

Advanced

Nginx Configuration Help

Posted by tconlon 
Nginx Configuration Help
February 24, 2022 07:46AM
Hi All,

Looking for a little help here.

thanks for any help

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 foobar.com
Location Site 1: foobar.com/skunk
Location Site 2: foobar.com/frog
Location Site x: foobar.com/buffalo
Laravel / PHP
It's own bitbucket repository (main)

Other Page Site: Works as expected
foobar.com/information
Vue
It's own bitbucket repository (information)

Landing Page Site:
foobar.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.foobar.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.foobar.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.foobar.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/foobar.com-access.log access;
access_log on;
error_log /var/log/nginx/foobar.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;
}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 222
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready