コンパイルとインストールnginxの設定とシンプルな

1、インストールの依存関係

-Y-develのインストールPCREのyumはzlibのdevel OpenSSLの-develの-GCC GCC C ++ make-     // PCRE、必要に応じてコンパイラのインストールOpenSSLの

2.アプリケーションユーザを作成します。

useraddの-M -s / sbinに/ nologinにnginxの

3、nginxのインストール

#tar XF nginx- 1.140 .tar.gzの-Cは/ usr / local / SRC / 
#cdは/ usr / local / SRC / nginx- 1.140 / 
#。/ 設定\
 --prefix =は/ usr / local / nginxの\
 --user = nginxの\
 --group = nginxの\
 --with- http_stub_status_module \
 --with- http_ssl_module \
 --without- http_rewrite_module \
 --with- http_gzip_static_module \
 --with-PCRE = /ホーム/ AP / APPUSER / WEB_SERVER /パッケージ/ pcre- 8.41 \
 --with-opensslの= /ホーム/ AP / APPUSER / WEB_SERVER /パッケージ/ opensslを1.0 ・2H \

注:
 --without-http_rewrite_module //デフォルトモジュールオープン上書き
前の圧縮ファイルを送信するように構成されたオープン// --with-http_gzip_static_module gzipの静的モジュール
--with-http_ssl_moduleは// HTTPSをサポートするために使用

4、nginxの開始、停止、

#は/ usr / local / nginxの/ sbinに/ nginxの-c /usr/local/nginx/conf/nginx.conf   // 指定された設定ファイルを開始します 
。#は/ usr / local / nginxの/ sbinに/ nginxの-sリロード// GR 
#を-HUP nginxのメインプロセスID(CATの/usr/local/nginx/logs/nginx.pidを)殺す   // GRは、 
#は/ usr / local / nginxの/ sbinに/ nginxの-s STOP   // クイックストップ 
#は/ usr / local / nginxの/ sbinに/ nginxの-s終了   // 、新しい要求が受信されていない接続は、他の停止中に完了する要求すること(この製造方法が推奨されます) 
#は/ usr / local / nginxの/ sbinに/ nginxの-t   // プロファイルnginxのかどうかを確認します正しいです

5、nginxのプロキシ

    サーバー{ 
        聞く        8080 ; 
        サーバー名はlocalhost。

        位置 / { 
            ルートHTML。
            インデックスのindex.html index.htmを。
        } 場所
        
         /ウェブ{prox_pass http://127.0.0.1:8080/web。} 
        場所/ WWW {prox_pass http://127.0.0.1:8080/web。} 

        error_page    500  502  503  504   / 50x.htmlと、
        位置 = / 50x.html { 
            ルートHTML。
        } 
    }

6、nginxの負荷分散

    上流java_server {      
        
        サーバー192.168.3.11:8080。
        
        サーバー192.168.3.12:8080 ; 
    }
     
    サーバー{ 
        聞く        8080 
        サーバー名はlocalhost。

    位置 / { 
            ルートHTML。
            インデックスのindex.html index.htmを。proxy_passます。http:
             // java_server。
        } 
    }

7、nginxの証明書の設定

    {Serverは
        、SSL 443聞く
        サーバー名はlocalhostを、

        ssl_certificate SSL / server.cerを; //公開鍵証明書(ノート証明書パスを、証明書は、私のnginxの/ confにして/ SSL /下にある)
        //プライベート; ssl_certificate_key SSL / server.key-証明書は、

        共有ssl_session_cache:SSL:10メートル; 
        ssl_session_timeout 10Mは、

        HIGHへのssl_ciphers:aNULL:MD5; !! 
        ON ssl_prefer_server_ciphers; 

        LOCATION / { 
            ルートHTML、
            インデックスのindex.htmlのindex.htm; 
        } 
    }を

 

おすすめ

転載: www.cnblogs.com/yuxl/p/11433864.html