Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
别名为domain的nginx virtualhost重定向到主域无效_Nginx - Fatal编程技术网

别名为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