yhidetoshi / Nginx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Alt Text

Nginxでやった事/勉強メモ

[インストール(構築)]

方法 リンク
手動 https://github.com/yhidetoshi/Nginx/blob/master/README.md#nginxのインストール手動
Chef https://github.com/yhidetoshi/chef_mac/tree/master/cookbooks/nginx
Fabric https://github.com/yhidetoshi/Nginx/blob/master/install-by-fabric/nginx-install.py
Docker https://github.com/yhidetoshi/Docker#mac環境でnginxjenkinsをリバースプロキシ環境を構築する

[Reverse_Proxy / LB / SSL /Redirect等の設定例]

-> https://github.com/yhidetoshi/Nginx/tree/master/conf

Nginxのインストール(手動)

  • packageでインストールする
# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
# yum -y install nginx
# service nginx start
  • ソースコードからインストールする
- ビルドに必要なライブラリ:PCRE/zlib/OpenSSL
- http://nginx.org/en/download.htmlからMainline versionをダウンロードする
- ソースをダウンロードしたら, ./configure, make, make installを順に実行
- PATHを通す:$ export PATH=/usr/local/nginx/sbin:$PATH
コマンド(#service) 役割
nginx start nginxを再起動する
nginx stop nginxを停止する
nginx restart nginxを再起動する
nginx reload nginxの設定を再読み込みする
nginx configtest nginxの設定ファイルの構文をチェック
nginx upgrade nginxの実行バイナリを無停止で差し替える
  • バーチャルサーバ -> ipアドレス、ポート、ホスト名ごとに設定でき、複数のhttpサーバを動かせる
http { 
  server {
    listen 80;
    server_name www.example.com; ...
  }
  server {
    listen 80;
    server_name static.example.com; ...
  }
}
ディレクティブ 構文 説明
server_name server_name hoge.xyz; (完全一致 => ワイルドカード => 正規表現)の順で優先される
root root /var/www/wordpress; サーバの公開ディレクトリを指定する

About


Languages

Language:Python 100.0%