I'm very new to NGINX and the whole configuration, so I managed to setup a server with the following config with the help from a friend:
server {
listen 80;
listen [::]:80;
server_name domain.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 80;
listen [::]:80;
server_name domain.de;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name domain.com domain.de;
root /var/www/html;
index index.php index.html index.htm;
there are multiple servers for my main page, some project pages, and some private pages. I have for every single TLD an own server because I don't want to have the TLD in the address bar changed on a redirect. Now my answer is, how can I simply get all these non-SSL Servers to one big Server(1/project) without redirecting to just one TLD?
Example:
Project.com, Project.de, Project.net and Project.org are redirecting over 5 of these non-SSL Servers to one SSL-enabled Server. When i'm going to http://project.net i'm beeing redirected to https://project.net. The TLD doesnt change at all, because of the single non-SSL Server setup.
What i want to achieve, that i can minify my config file to have one non-SSL Server per Project redirecting to https without changing the domain.
:80 Server :443 Server
http domain.net ---> https domain.net ([non-SSL 01] ---> [SSL 01]) http domain.com ---> https domain.com ([non-SSL 02] ---> [SSL 01]) http domain.de ---> https domain.de ([non-SSL 03] ---> [SSL 01])
http project.de ---> https project.de ([non-SSL 04] ---> [SSL 02]) http project.com ---> https project.com ([non-SSL 05] ---> [SSL 02]) and so on