我们打开nginx.conf文件,在我们需要重定向的server中进行相关网站的重定向,下面是我的例子.
server {
listen 80;
server_name abc.vigoow.asia;
location / {
root html;
index index2.html ;
}
location = /g/{
return 301 http://google.com;#把abc.vigoow.asia/g/重定向到谷歌
}
location = /c/{
return 301 http://cloudflare.com;#把abc.vigoow.asia/c/重定向到cloudflare
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /404.html {
root html;
}
location = /50x.html {
root html;
}
}