I'm trying to add my machine's LAN IP as a 'failthrough' location to use in the event the main server has issues.
Lately, my main server name (i.e. https://myserver.domain.com) has been having some issues due to LetsEncrypt certs issues, so any URL running on my server using that domain name fails as well. What I want is to have Nginx automatically pass it to the machine's IP instead if it detects the domain name itself is down.
I'm using the Docker LinuxServer LetsEncrypt container, and I've tried just adding the IP to the server_name
variable in the config, but after restarting the container, nothing appears to change when trying to navigate to https://myserver.domain.com (it still just gives the same error page instead of redirecting to the IP).
Here's the current config with the issue:
server {
listen 443 ssl http2 default_server;
root /config/www;
index index.php index.html index.htm;
server_name myserver.* 192.168.0.194:3333;
# enable subfolder method reverse proxy confs
include /config/nginx/proxy-confs/*.subfolder.conf;
# Tell search engines not to crawl/add this domain
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
# all ssl related config moved to ssl.conf
include /config/nginx/ssl.conf;
# enable for ldap auth
#include /config/nginx/ldap.conf;
client_max_body_size 0;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
Note this line in particular; the IP as the second server is the intended failthrough IP:
server_name myserver.* 192.168.0.194:3333;
Also note: if I just use https://192.168.0.194:3333
directly in a browser, it navigates to the intended page fine, so this has to be something config-wise with Nginx that I'm trying to solve. It seems like a pretty simple issue, but I'm not super familiar with Nginx config nuances yet.