Sample - rewrite
server {
listen 80 ;
listen [::]:80 ;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
rewrite ^/test1(.*) <http://www.google.com> permanent;
rewrite ^/test2(.*) <http://www.google.com>;
try_files $uri $uri/ =404;
}
}
Sample - return
server {
listen 80 ;
listen [::]:80 ;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
return 301 <http://www.google.com> ;
return 302 <http://www.google.com> ;
try_files $uri $uri/ =404;
}
}
Sample - proxy_pass
server {
listen 80 ;
listen [::]:80 ;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
proxy_pass <http://www.google.com> ;
try_files $uri $uri/ =404;
}
}