I'm having a nginx server and a domain, example.com. Each customer has his own subdomain, like wsb.example.com etc. Their content changes via PHP, but all subdomains get redirected to the same folder on the web server.
The only problem I'm having, is with accessing the domain without https. https://whatever.example.com/ works, but whatever.example.com redirects me to https://*.example.com/
What am I doing wrong?
server {
listen *:80;
listen *:443 ssl;
server_name *.alterament.de;
index index.php;
root /var/www/webapp.alterament.de/public;
ssl_certificate ssl/alterament.de.crt;
ssl_certificate_key ssl/alterament.de.key;
if ($ssl_protocol = "") {
rewrite ^/(.*) https://$server_name/$1 permanent;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /resources {
root /var/www/webapp.alterament.de;
}
}