パーソナルツール
現在位置: ホーム MY CLEF Ploneのフロントにnginxを置いてみる
ドキュメントアクション

Ploneのフロントにnginxを置いてみる

Plone.orgのまねをしてnginxとvarnishで運用できないかと思案して、とりあえずnginxをインストールしてみます。

nginxのインストールと設定

個人的な趣向からconfigureにオプションを2つつけてインストールしました。

./configure --sbin-path=/usr/local/sbin --with-http_ssl_module

configureが終了するとオプションのまとめが出力されたりしていい感じです。

Configuration summary
  + using system PCRE library
  + using system OpenSSL library
  + md5 library is not used
  + sha1 library is not used
  + using system zlib library

  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/sbin"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "/usr/local/nginx/client_body_temp"
  nginx http proxy temporary files: "/usr/local/nginx/proxy_temp"
  nginx http fastcgi temporary files: "/usr/local/nginx/fastcgi_temp"

今はapacheが80番ポートを使っているのでポートを8888番に変更して試しに起動。適当にinitスクリプト作ってrc3とrc5にリンク張っておけば当面は問題ないでしょう。

# vi /usr/local/nginx/conf/nginx.conf
...
server {
    listen 8888; #ポートを変更
    ...
# vi nginx #適当に起動スクリプトを書く
# cp nginx /etc/init.d/
# chmod +x /etc/init.d/nginx
# ln -s /etc/init.d/nginx /etc/rc.d/rc3.d/S85nginx
# ln -s /etc/init.d/nginx /etc/rc.d/rc5.d/S85nginx
# /etc/init.d/nginx start

テスト用Plone環境の準備

テスト用のbuildout環境を作ります。ポート番号を9080番にしておきます。

$ paster create -t plone3_buildout plone3test
  ...
  ...
   Enter http_port (HTTP port) [8080]: 9080
  ...

bootstrap.py、buildoutを実行して環境を作り、インスタンスを起動します。

$ cd plone3test
$ python bootstrap.py
$ bin/buildout
$ bin/instance start

ブラウザからZMIに入ってPloneインスタンスを作成しておきます。

nginxからPloneにとばす

情報が少ないですが、英語のWiki(powered by MoinMoin!)があるのでそこらへんを見ながら設定してみます。serverディレクティブの前にupstreamの設定をして、serverディレクティブにはproxy設定を追加します。

※コピペしたのが古かったので更新

server {
    listen 8888;
    server_name nagosui.org;

    #ヘッダの設定など
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    location / {
        proxy_pass http://localhost:9080/VirtualHostBase/http/nagosui.org:8888/VirtualHostRoot/;
    }

nginxをリスタートします。

# /etc/init.d/nginx restart

ブラウザからPloneインスタンスのアドレス(例えばhttp://nagosui.org:8888/Plone3/)にアクセスして見えていればたぶん成功。

カテゴリ
Linux Linux
Plone Plone
コメントを追加

下のフォームに記入してコメントを追加することができます。プレーンテキスト形式。

(必須)
(必須)
(必須)

このBlogについて
Plone, Zope, Pythonなどのトピックについてのメモです。
カテゴリ
Plone (101)
Plone Products (23)
COREBlog2 (31)
COREBlog1 (29)
ReadingCOREBlog (7)
Zope (66)
Turbogears (18)
Django (12)
Python (27)
Linux (32)
Nagosui (13)
Design (35)
Misc (49)
moblog (5)
Mac (1)
最近のエントリ
Ploneのレイヤー機能を使ってテーマを管理する nyusuke 2010年01月03日
MacOSXにPython2.4をインストール nyusuke 2009年03月21日
Ploneを3.1から3.2へアップグレード nyusuke 2009年03月01日
Plone3.2+その他もろもろのレシピ nyusuke 2009年03月01日