Quick question:
I have been struggling with external access of HA, I have one instance of HA already working on domain ha.domain.com and now I wanted to add external access for second HA instance on ha2.domain.com.
I have selfhosted NGINX running on proxmox pve. Both instances are reachable on 8123 port.
But can’t get second one on external access.
Is it possible that both are on same port (but different IP obviously)? So NGINX is proxying: ha.domain.com - > 192.168.1.199 ha2.domain.com - > 192.168.1.197
Is it possible this is the culprit?
I have certs issued on ha2 nad ha instance, both should be reachable on https.
This is certainly possible with nginx. I have three instances that I proxy through nginx, all on the same port. I’m not following the exact failure mode, are both urls proxying to the same instance? Would likely need to see config files to help much.
Hm, can’t figure it out…still… when running sudo certbot certonly --nginx -d ha2.domain.com
I get:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.
2024/12/17 20:31:35 [emerg] 548#548: unknown log format "standard" in /etc/nginx/conf.d/default.conf:11
nginx: configuration file /etc/nginx/nginx.conf test failed
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\n2024/12/17 20:31:35 [emerg] 548#548: unknown log format "standard" in /etc/nginx/conf.d/default.conf:11\nnginx: configuration file /etc/nginx/nginx.conf test failed\n')
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
# "You are not configured" page, which is the default if another default doesn't exist
server {
listen 80;
listen [::]:80;
set $forward_scheme "http";
set $server "127.0.0.1";
set $port "80";
server_name localhost-nginx-proxy-manager;
access_log /data/logs/fallback_access.log standard;
error_log /data/logs/fallback_error.log warn;
include /etc/nginx/conf.d/include/assets.conf;
include /etc/nginx/conf.d/include/block-exploits.conf;
include /etc/nginx/conf.d/include/letsencrypt-acme-challenge.conf;
location / {
index index.html;
root /var/www/html;
}
}
# First 443 Host, which is the default if another default doesn't exist
server {
listen 443 ssl;
listen [::]:443 ssl;
set $forward_scheme "https";
set $server "127.0.0.1";
set $port "443";
server_name localhost;
access_log /data/logs/fallback_access.log proxy;
error_log /dev/null crit;
include /etc/nginx/conf.d/include/ssl-ciphers.conf;
ssl_reject_handshake on;
return 444;
}
I’m really lost now. Anyone has any idea what should be wrong in configuration file(s) as it says misconfiguration…
I would be very thankful for any help.
PS: Renew other certs for my othe subdomains work OK, but obtaining new certs doesn’t work
sudo certbot certonly --standalone --preferred-challenges http -d ha2.-------.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Certificate not yet due for renewal
You have an existing certificate that has exactly the same domains or certificate name you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/ha2.-----------.conf)
What would you like to do?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Keep the existing certificate for now
2: Renew & replace the certificate (may be subject to CA rate limits)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Renewing an existing certificate for ha2.--------.xxx
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/ha2.----------/fullchain.pem
Key is saved at: /etc/letsencrypt/live/ha2.-----------/privkey.pem
This certificate expires on 2025-03-17.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
* Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
* Donating to EFF: https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If I copy content od .pem files from above to text editor and save it as files on my nginx LXC and them upload to NPM web server and add custom certificate, the ha2.domain.com instance I can’t connect with https but only http. If I connect https I get SSL_ERROR_UNRECOGNIZED_NAME_ALERT.
Tried to configure nginx.conf and default.conf but after I fixed log error, I got new error:
Error while running nginx -c /etc/nginx/nginx.conf -t.
2024/12/18 20:10:12 [emerg] 536#536: "proxy_cache" zone "public-cache" is unknown in /etc/nginx/nginx.conf:61
nginx: configuration file /etc/nginx/nginx.conf test failed
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\n2024/12/18 20:10:12 [emerg] 536#536: "proxy_cache" zone "public-cache" is unknown in /etc/nginx/nginx.conf:61\nnginx: configuration file /etc/nginx/nginx.conf test failed\n')
Looks like you have some misconfigured cache. If you don’t want to use cache, you have to remove the references to cache, I can’t see in your config, but maybe there are remains on /etc/nginx/sites-available.
Look for things like
If you don’t have much experience with reverse proxy, be careful with the configs. For example, if you are exposing 443 already, there is no need to expose port 80 as well, there are more simple ways (free) you can access HA externally, maybe try TailScale for example.
If you are using nginx to learn, I would go over the docs and read it a bit,it will help as well.
@brunobrossi thanks.
There is default file in sites-available
and inthere:
server {
listen 81 default_server;
listen [::]:81 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
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;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
I’m not really a beginner with nginx but since now all worked great. I wanted to add another ha instance to access externally but then thing got messed up and can’t figure it out. On a web server I get internal error message each time I try to change something and if I click save button internal error message pops up (after closing the windows and refreshing the page, everything looks normal and saved
Right now I’m exposing port 80 because I tried to obtain certificates… renewing of already configured servers works great, but new one is a pain.
I see yeah, for the error you are having now, it is some misconfigured cache, what you can do it try to explicitly disable, or enable some simple browser caching and see if it goes through
@brunobrossi thanks.
I started with cache but thing didn’t change, it turned out some other errors started or at least showed with nginx -t command.
So instead of spending more time I just installed another nginx server on my LXC in Proxmox and this time I used openresty and I turned out there was indeed misconfiguration because on new server everything went fine and smooth.
I think I accidenty checked HSTS button which messed my config.