Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

sub.domain.tld linked back to domain.tld

$
0
0
hello,

i am new to nginx and got two enabled sites,

1) nighlander.de www.nighlander.de;

server {
listen 80;
server_name nighlander.de www.nighlander.de;
rewrite ^ https://$server_name$request_uri? permanent;
}

server {
listen 443 ssl;

ssl_certificate /etc/nginx/ssl/nighlander.de.crt;
ssl_certificate_key /etc/nginx/ssl/nighlander.de.key;

server_name nighlander.de www.nighlander.de;
index index.php index.htm index.html;

root /usr/share/nginx/nighlander.de;

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

location / {
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm-nighlander.de.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}

2) analytics.nighlander.de

server {
listen 80;
server_name analytics.nighlander.de;
rewrite ^ https://$server_name$request_uri? permanent;
}

server {
listen 443 ssl;

ssl_certificate /etc/nginx/ssl/analytics.nighlander.de.crt;
ssl_certificate_key /etc/nginx/ssl/analytics.nighlander.de.key;

server_name analytics.nighlander.de;
index index.php index.htm index.html;

root /usr/share/nginx/analytics.nighlander.de;

access_log /var/log/nginx/analytics.nighlander.de/access.log;
error_log /var/log/nginx/analytics.nighlander.de/error.log;

location / {
}

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm-analytics.nighlander.de.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}

My idea is, that all request regarding nighlander.de, www.nighlander.de, test123.nighlander.de (http oder https) are redirected to https://nighlander.de

My idea for analytics.nighlander.de is, that also the http request ist redirected to https://analytics.nighlander.de.

So if both above showed confs are active, the following situation is:

http://test123.nighlander.de (also https) is redirected to https://analytics.nighlander.de
http://analytics.nighlander.de is redirected to https://nighlander.de but
http://analytics.nighlander.de/index.php is redirected to https://analytics.nighlander.de

i want a redirect for EVERY subdomain, that is not specified with a conf file is redirected to https://nighlander.de

i want a redirect for http://analytics.nighlander.de to https://analytics.nighlander.de

maybe the confs are much buggy - does someone have a good solution?

Thanks a lot
Henning

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>