I https://example.comNginx Umleitung von nicht existierenden Subdomains
hat auch https://admin.example.com
Wenn Anfrage an example.com oder admin.example.com oder forum.example.com nginx Umleitungen erhalten haben SSL-Verbindung (https://example.com etc ..)
example.com.conf:
server {
charset utf-8;
client_max_body_size 128M;
listen 443 ssl;
server_name example.com www.example.com;
root /var/www/example.com/...;
index index.php;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AE$
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_stapling on;
ssl_stapling_verify on;
add_header Strict-Transport-Security max-age=15768000;
access_log /var/log/nginx/example.com-access.log;
error_log /var/log/nginx/example.com-error.log;
location/{
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
location ~* \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
access_log off;
expires 7d;
}
error_page 404 /404.html;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(ht|svn|git) {
deny all;
}
# let's encrypt (ssl folder)
location ~ /.well-known {
allow all;
}
}
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}
wenn ich wünsche nicht vorhandene Subdomains wie xxx.example.com es https://example.com über default.conf umleitet
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://example.com;
}
Aber wenn ich https://xxx.example.com anfordern Öffnen es wie admin.example.com mit SSL sert Fehler. Aber ich muss es auch wie xxx.example.com Anfrage umleiten.
Wenn ich Anfügen default.conf mit
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name _;
return 301 https://example.com;
}
Ich bin immer an alle meine Gastgeber ERR_CONNECTION_REFUSED.
Gereinigt default_server von default.conf und fügen Sie es zu example.com.conf. Ja, ich habe sert Fehler beim Anfordern von "https://xxx.example.com", aber nachdem ich auf "https://example.com" umgeleitet habe, wie ich wollte. Danke euch allen! – ZeiZ