server {
listen 80;
server_name aaa.com bbb.com ccc.com;
return 301 http://www.$host$request_uri;
}
server {
listen 80;
server_name www.aaa.com;
}
server {
listen 80;
server_name www.bbb.com;
}
server {
listen 80;
server_name www.ccc.com;
}
重點在
return 301 http://www.$host$request_uri;
$host
in this order of precedence: host name from the request line, or host name from the 「 Host 」 request header field, or the server name matching a request
$http_name
arbitrary request header field; the last part of a variable name is the field name converted to lower case with dashes replaced by underscores
$server_name
name of the server which accepted a request
0 意見:
張貼留言