So I'm trying to set it up where my subdomain: "forum.project-freedom.net" visits the directory of /var/www/forum/ on my server. I'd like the main URL, "project-freedom.net" to be sat on the /var/www/html/ directory of my server. I'm utilizing nginx and here's my current conf file:
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name project-freedom.net www.project-freedom.net;
ssl_certificate /etc/ssl/certs/1546559737repl_1.crt;
ssl_certificate_key /etc/ssl/private/project-freedom.key;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
location /forum {
alias /var/www/forum;
index index.php index.html index.htm;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Change to match your PHP version
}
}
# Redirect non-www to www
if ($host = 'project-freedom.net') {
return 301 https://www.project-freedom.net$request_uri;
}
# Redirect HTTP to HTTPS
if ($scheme != "https") {
return 301 https://$server_name$request_uri;
}
}
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name forum.project-freedom.net;
ssl_certificate /etc/ssl/certs/1546559737repl_1.crt;
ssl_certificate_key /etc/ssl/private/project-freedom.key;
root /var/www/forum;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; # Change to match your PHP version
}
# Redirect HTTP to HTTPS
if ($scheme != "https") {
return 301 https://$server_name$request_uri;
}
}