nginx default domain name or ip address jump several skills


 IP access is prohibited, if there is no matching server name, the default will be found and 403 will be returned.

server {
listen 80 default;
return 403;
}

Or 301 jump to the home page
server {
listen 80 default;
server_name _;
rewrite ^(.*) https://moneyslow.com/$1 permanent;
} 

A.com jumps to b.com (server segment configuration)
if ($host ~ '^a.com'){
return 301 https://b.com$request_uri;
}

If not b.com redirect to b.com
if ($host != 'b.com') {
rewrite ^/(.*)$ http://b.com/$1 permanent;
}

Post a Comment

Previous Post Next Post