インストール

公式サイトにyumパッケージがあるのでそれを使うのが楽。

rpm -Uvh http://nginx.org/packages/centos/5/i386/RPMS/nginx-1.4.4-1.el5.ngx.i386.rpm

CentOS 6.x のyumインストール

rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install nginx

上記YUMインストールでの設定

設定全般の注意点

文末の;を忘れがち。

nginx

listen 80 → 8080に変更
phpの設定は絶対パスでやるうまくいったが、$document_rootだと"primary script unknown"が出てしまう

httpsへの強制リダイレクト

return 301 https://$host$request_uri;

SSL

https://cspssl.jp/support/nginx/config.php

中間証明書はサーバー証明書、中間証明書の順に結合する必要がある。

php-fpm

userをnginxに変更するだけでOK。

その他

Apacheからの移行

Log

認証

ほぼそのままでOK

rewrite

書き直しが必要。

if ( $remote_addr = 'xx.xx.xx.xx' ) {
  return 302 https://$host$request_uri;
}
if ( $request_method ~ (GET)$ ) {
  return 302 https://$host$request_uri;
}
Counter: 3036, today: 1, yesterday: 0

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-10-14 (金) 13:16:53