nginxをインストールする。
■インストール
以下のコマンドでインストールをおこなう。
yum --enablerepo=epel install nginx
epelについて
Fedoraと同等環境を実現するRHEL用レポジトリであるが、初期状態では使えないため以下のコマンドでリポジトリを追加する。
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm rpm -Uvh epel-release-5*.rpm
■設定
以下のコマンドで設定ファイルを編集する。
vi /etc/nginx/nginx.conf
80番ポートをドキュメントルートを「/var/www/vhosts/domain/httpdocs」とする場合、以下のように記述する。
listen 80; root /var/www/vhosts/domain/httpdocs;
HTTP PUTメソッドを許可する
location / { root /var/www/vhosts/domain/httpdocs; index index.html index.htm; dav_methods PUT; create_full_put_path on; dav_access group:rw all:r; }
IPアドレスで制限する
location / { allow 192.168.1.0/32; deny all; }
以下のコマンドで起動する。
/etc/init.d/nginx start
常に起動しておく場合、以下のコマンドを実行する。
chkconfig nginx on chkconfig nginx --list
設定ファイルを変更した場合は以下のコマンドでreloadする。
/etc/init.d/nginx reload