old-site.example現在、nginx には 2 つの有効なサイト構成があります。それらを と と呼びましょうnew-site.example。他にアクティブなサイト構成はありません。
old-site.exampleに 301 リダイレクトする必要がありnew-site.exampleます。old-site.exampleこれは現在、構成が単独である限りうまく機能します。構成ファイルを追加すると、new-site.exampleリダイレクトされなくなります。
oldsite.conf:
server {
listen 80;
server_name *.old-site.example;
rewrite_log on;
location / {
return 301 http://www.new-site.example$request_uri;
}
}
newsite.conf:
server {
listen 80;
server_name www.new-site.example;
charset utf-8;
location / {
#forward to application server
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080;
}
}
その他の構成の詳細:
- Nginx 1.5.1 の背後で実行されるアプリケーション サーバーとしての JBoss AS7