我已經開始wildcard SSL-Certificates
通過acme-dns-client
.雖然有一個簡單的方法可以覆蓋我的所有子網域,但我遇到的問題是沒有覆蓋我的無 www 網域。
因此我認為這可能是個好主意,只是change the no-www Mainsite
為了www.example.net
而不是example.net
有誰建議如何更改這些設置,因為它們在 WordPress 多站點管理儀表板中不可用,在這裡您可以只更改子頁面的子網域。
我已經嘗試將以下行添加到wp-config.php
.
define('WP_HOME','https://www.example.net');
define('WP_SITEURL','https://www.example.net');
但這還沒有成功。我使用 nginx 作為我的根網路伺服器系統。
Nginx 設定
server {
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_connect_timeout 300s;
fastcgi_read_timeout 300s;
fastcgi_send_timeout 300s;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
root /var/www/wordpress;
index index.php;
server_name example.net www.example.net get.example.net *.example.net;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
#settings for file upload
client_max_body_size 32M;
}
server {
if ($host = example.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name example.net *.example.net;
return 404; # managed by Certbot
}