Welcome! Log In Create A New Profile

Advanced

Reverse proxy to SSL with nginx

Posted by Simon2020 
Reverse proxy to SSL with nginx
July 06, 2020 05:52AM
The topic is much nicer formatted here:
https://community.letsencrypt.org/t/2-server-2-certbots-same-ip-nginx-proxy-redirect/127218/1

Setup:

Two server in a home network
Same public IP adress
Server 1 with nginx, Server 2 with apache

Aim:

Both server create ssl certificates, server 1 for domain 1, server 2 for domain 2
Router redirects all traffic to Server 1
Server 1 redirects all traffic for domain 2 to server 2

What I tried:

entries in nginx.conf adapted

Problem: When trying to connect to domain 2, error message “SSL_ERROR_BAD_CERT_DOMAIN”

content of nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##
gzip on;

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

server {
listen 80;
server_name huntworker.ddns.net;
return 301 https://$host$request_uri;
}

server {
listen 80;
listen 443;
server_name bardhome.de;

location / {
proxy_pass 192.168.101;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
}
}

server {
listen 80 default_server;
listen 443 ssl;
listen [::]:80 default_server;


ssl_certificate /etc/letsencrypt/live/huntworker.ddns.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/huntworker.ddns.net/privkey.pem;

server_name _;

location / {
proxy_pass http://192.168.178.2:81/;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
}

}

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 104
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready