Welcome! Log In Create A New Profile

Advanced

Multiple domain config error

Posted by nickloxx 
Multiple domain config error
April 20, 2021 06:01PM
Hi everyone,

I'm pretty new to nginx, but so far really dig it. I currently have 2 domains set up on my local testing server, propzsearch.com and advancedaudioengineering.com.

Both of these sites work fine, however I am noticing that as I try to add new things to the server (phpmyadmin, a mail server, etc etc) that everything new I add whenever I try to visit it in a browser, just get's redirected to my 2nd domain name (advancedaudioengineering.com), and even if I try to access localhost, it get's directed as well.

So https://localhost/phpmyadmin ends up redirecting to https://www.advancedaudioengeering.com

This is puzzling to me, and I figure it's probably just a lack of understanding on my part about how nginx is configured.

So here is my default conf file, which I assume handles localhost and anything else that doesn't fall under a domain name.

# Default server configuration (default.conf)
#
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;

# Add index.php to the list if you are using PHP
index index.php index.html index.htm;

server_name localhost;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}


and here is my aae.com conf file (which is almost identical to my propzsearch.com conf file)
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.advancedaudioengineering.com;
set $base /var/www/www.advancedaudioengineering.com;
root $base/html;

# SSL
ssl_certificate /etc/letsencrypt/live/www.advancedaudioengineering.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.advancedaudioengineering.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/www.advancedaudioengineering.com/chain.pem;

# security
include nginxconfig.io/security.conf;

# index.php
index index.php;

# index.php fallback
location / {
try_files $uri $uri/ /index.php?$query_string;
}

# additional config
include nginxconfig.io/general.conf;
include nginxconfig.io/wordpress.conf;

# handle .php
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
include nginxconfig.io/php_fastcgi.conf;
}
}

# subdomains redirect
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name *.www.advancedaudioengineering.com;

# SSL
ssl_certificate /etc/letsencrypt/live/www.advancedaudioengineering.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.advancedaudioengineering.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/www.advancedaudioengineering.com/chain.pem;
return 301 https://www.propzsearch.com$request_uri;
}

# HTTP redirect
server {
listen 80;
listen [::]:80;
server_name .www.advancedaudioengineering.com;
include nginxconfig.io/letsencrypt.conf;

location / {
return 301 https://www.advancedaudioengineering.com$request_uri;
}
}

So I figure there's probably a simple solution to restore localhost and other things (phpmyadmin, mail.propzsearch.com) to working order, I'm just stumped as to what I'm missing.

thanks everyone!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 236
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