LoginSignup
4
4

More than 5 years have passed since last update.

CentOS6+mod-wsgi+pyenv+python2.7.11+apache

Posted at

設定

pyenvの導入

公式サイトを参照。

pyenvを用いてpython2.7.11をインストールする。

オプションCFLAGS=-fPICは必須。
Python2.7.11はデフォルトでは内部文字コードはUCS4でインストールされる。

$ CFLAGS="-fPIC" pyenv install 2.7.11
$ pyenv global 2.7.11

apacheのインストール

他を参照。

mod_wsgiのインストール

mod_wsgi.tar.gzを公式サイトよりダウンロードする。
一つのPythonしか指定できないようである。

# ダウンロードして展開する。
$ cd ~/download
$ wget https://pypi.python.org/packages/source/m/mod_wsgi/mod_wsgi-4.4.22.tar.gz
$ tar zxvf mod_wsgi-4.4.22.tar.gz
$ cd mod_wsgi-4.4.22

# pyenvでのPython環境のインストール先を指定する。
$ ./configure --with-python=/home/vagrant/.pyenv/versions/2.7.11/bin/python
$ make
$ sudo make install

ディレクトリ権限の設定

以下のようなメッセージが出る場合

(13)Permission denied: mod_wsgi (pid=23797): Unable to connect to WSGI daemon process '***' on '/etc/httpd/logs/wsgi.12880.0.1.sock' after multiple attempts., referer: http://dummy.test

pyenvのディレクトリを変更するか、パーミッションの変更を行う。

$ chmod 755 /home/vagrant

virtualenvは使えない

pyenv+virtualenvで利用している事例を確認できなかった。
PythonPathなどを無理矢理通すと動作するかもしれない。

参考ページ

mod-wsgi を python3.5.0 + pyenv + Apache2 で、AmazonLinux 上に構築

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4