A
A
Alexey Zhivotovsky2017-02-18 15:27:13
Nginx
Alexey Zhivotovsky, 2017-02-18 15:27:13

How to set up Redirect in Nginx with different SSL domains and one IP?

I decided to raise NginX on one of the servers and completely switch to it from Apache. And also take domains using A-Record from two other servers and bind these domains to a server with NginX

There is such a configuration:

Three servers
- Server Nginx
- Server B
- Server C

In the NameServer settings on Server B *domainserverB.com is A-Record to the ip address for Server Nginx

I did the same for Server C and redirected to the server with Nginx

Server Nginx has its own domain "domainserverNginx.com" and its external Nginx ip address

The problem is that I get three
Default.conf configs
DomainserverB.conf with SSL
DomainserverC.conf with SSL

Sites work, but if I enter " https://domainserverNginx.com ", then for some reason I am redirected to the site "domainserverA.com", and should go to return 444

The strangest thing is that if I am in Default .conf for ssl I enter listen ip-address Nginx:443 instead of listen 443, then domainserverA.com and domainserverB.com sites stop opening. Since they are only set to SSL

Default.conf

server {
        listen  ip-адрес Nginx:80;
        server_name  domainserverNginx.com;
        rewrite ^ https://domainserverNginx.com$request_uri? permanent;
}
server {
        listen 443;
        server_name  domainserverNginx.com;
        return 444;
}


DomainserverB.conf with SSL
server {
    listen  ip-адрес Nginx:80;
    server_name  .domainserverB.com;
    rewrite ^ https://www.domainserverB.com$request_uri? permanent;
}

server {
    listen  ip-адрес Nginx:443 ssl http2;
    server_name  .domainserverA.com;
    root...
.....
}


DomainserverC.conf similar to DomainserverB.conf

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2017-02-18
@Quatsch

You do not have the ssl option for the domain, and there are no certificates, so you are your own Pinocchio

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question