August 2017
Intermediate to advanced
278 pages
8h 53m
English
As in the previous recipe, we need to have two distinct server blocks. Here's how to redirect the old site:
server {
listen 80;
server_name oldsite.nginxcookbook.com;
return 301 http://newsite.nginxcookbook.com$request_uri;
}
server {
listen 80;
server_name newsite.nginxcookbook.com;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
Read now
Unlock full access