ドメインを実現するためにジャンプ

一、 www.a.com - > www.b.com

1 、ターゲット:ページで入力www.a.comの時間は、自動的にジャンプwww.b.com

2 、ステップ:    

(1)  のインストール nginxの、確保nginxのがアクセスすることができます

(2)  変更 nginxの設定ファイルを

(3)  再起動 nginxのサービス

(4)ブラウザテスト

3、操作手順

ファイアウォールとLinuxのセキュリティをオフにします

[ルート@ localhostの〜]#systemctlの停止firewalld 
[ルート@ localhostのは〜]#iptablesの- F 
[ルート@ localhostの〜]#のsetenforce 0

 

nginxの通常のアクセスの場合、構成ファイルを変更

 

[ルート@ localhostの〜]#のvimのは/ usr / local / nginxの/ confに/ nginx.conf
 場合($ホスト= " www.b.com " ){ 
        書き換え ^ $ HTTP(*):// www.a.com / $ 1永久; 
 }

 

テスト文法、再起動

[ルート@ localhostの〜]#のnginxの- トン
のnginx:設定ファイルの構文/usr/local/nginx/conf/nginx.confがある、[OK] 
nginxの構成ファイルの /usr/local/nginx/conf/nginx.confテストがある成功

  [ルート@ localhostの〜]#nginxの
  nginxの:失敗した0.0.0.0:80にバインド()[EMERG]:(98すでに使用中のアドレス)
  nginxのは:0.0.0.0:80にバインドを()[EMERG]は失敗した(98:住所既に)使用中の
  nginxの:0.0.0.0:80にバインド()EMERG]は失敗しました(98:既に使用中の)アドレス
  nginxの:失敗0.0.0.0:80にバインド()EMERG(98:既に使用中のアドレス)

ページのテスト(アクセスwww.b.com、www.a.comを返します)

 

 

 

二、www.a.com / a.html - > www.a.com/file/a.html

1、ターゲット:ページ内の入力 www.a.com/a.html 時間は、自動的にジャンプwww.a.com/file/a.html

2、ステップ:

(1)  のインストール nginxのは、通常のアクセスを確保することができ

(2)  変更 nginxの設定ファイルを

(3)  再起動 nginxのサービス

(4)  は/ usr / local / nginxの/ HTML ファイルの作成a.htmlを、書く内容" 1111111111 "

(5)  は/ usr / local / nginxの/ htmlのフォルダの作成ファイルファイルの作成、ファイルa.htmlを、の内容を書き込む" 22222222 "

(6)  ブラウザテスト

3、操作

ファイアウォールとLinuxのセキュリティをオフにします

 

[ルート@ localhostの〜]#systemctlの停止firewalld 
[ルート@ localhostのは〜]#iptablesの- F 
[ルート@ localhostの〜]#のsetenforce 0

 

 

 

nginxのインストールには、設定ファイルを変更し、終了しました

 

[ルート@ localhostの〜]#のvimのは/ usr / local / nginxの/ confに/ nginx.conf 
場所 / a.html { 
        書き換え ^ $のhttp:(*)// www.a.com/file/a.html永久; 

}

 

nginxのサービスを再起動します

[ルート@ localhostの〜]#のnginxの- トン
のnginx:設定ファイルの構文/usr/local/nginx/conf/nginx.confがある、[OK] 
nginxの構成ファイルの /usr/local/nginx/conf/nginx.confテストがある成功しました
[ルート@ localhostの]#nginxの
nginxの:[EMERG]バインド()に0.00.080(失敗98:既にアドレス使用)
nginxの:[EMERG]バインド()に0.00.080は失敗し(98:既にアドレス使用)
nginxの:[EMERG]バインド()に0.00.080(失敗98:既にアドレス使用)
nginxの:[EMERG]バインド()に0.00.080(失敗98:既にアドレス使用)
nginxの:[EMERG]バインド()に0.00.080(失敗98:アドレス既に使用)
nginxの:[EMERG]まだ結合しませんでした()

ファイルa.htmlを作成し、「11111111」の内容を書き込みます

[ルート@ localhostの〜]#のCDは/ usr / local / nginxの/ HTML / 
[ルート@ localhostのhtmlの]#のVimのa.html
1111111111

「22222222」のファイルフォルダを作成し、ファイルa.htmlでファイルを作成し、コンテンツの準備

[ルートlocalhostの@〜]#のCDは/ usr / local / nginxの/ HTML / 
[ルート@ localhostのhtmlの]#1は、mkdirファイル
[ルート@ localhostのhtmlの]#LSの
50x.html index.htmlファイル
[ルート@ localhostのhtmlの]#のCDファイル / 
[ルート@ localhostのファイル]#タッチa.html 
[ルート@ localhostのファイル]#のVimのa.html 
22222222

 ブラウザテスト(アクセスwww.a.com/a.html、リターンwww.a.com/file/a.html)

 

 

 

 

 

おすすめ

転載: www.cnblogs.com/tanxiaojuncom/p/11549148.html