nginx之Rewrite Rules(十三)
servername1, servername2
server{
listen 80;
server_name servername1;
location / {
xx
}
}
server{
listen 80;
server_name servername2;
location / {
xx
}
}
server {
listen 80;
server_name servername1, servername2;
location / {
if($http_host == servername1) {
rewrite (.*) http://servername1$1;
}
}
}
try_files
server {
listen 80;
server_name localhost;
location /a {
root /html;
try_files $uri $uri/ /others/$uri.html;
}
}
如果觉得文章对您有用,请点下推荐。您的支持将鼓励我继续创作!