别名为domain的nginx virtualhost重定向到主域无效
在安装了具有多个域名的虚拟主机后,我喜欢将所有域名重定向到主域名 我在阅读完服务器页面后尝试,但不重定向到主域别名为domain的nginx virtualhost重定向到主域无效,nginx,Nginx,在安装了具有多个域名的虚拟主机后,我喜欢将所有域名重定向到主域名 我在阅读完服务器页面后尝试,但不重定向到主域 # # Note: This file must be loaded before other virtual host config files, # # HTTP server { server_name host01.mydomain.es; return 301 $scheme://web.mydomain.es$request_uri; } server
#
# Note: This file must be loaded before other virtual host config files,
#
# HTTP
server {
server_name host01.mydomain.es;
return 301 $scheme://web.mydomain.es$request_uri;
}
server {
# Listen on ipv4
server_name web.mydomain.es;
# host01.mydomain.es www.mydomain.es;
# Redirect all insecure http:// requests to https://
# return 301 https://$host$request_uri;
root /home/albarid/web/albarid/public;
index index.html index.htm index.php;
charset utf-8;
#listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/host01.mydomain.es/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/host01.mydomain.es/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
}
server {
if ($host = host01.mydomain.es) {
return 301 https://web.mydomain.es$request_uri;
} # managed by Certbot