概要
全てはタイトルが物語っているのですが、要はそういうことです。
環境は
です。ちなみにPython歴3日なので、Pythonのバージョンについて良く分かっていません。
内容
インストールしたいもの。
というものが必要らしいです。
pip install mod_wsgi pip install mod-wsgi-httpd
でインストールします(アンダースコアとハイフンと統一すればいいのに)。
インストールしたいものをインストールする前にインストールしなければならないもの
yum -y install httpd-devel yum -y install gcc yum -y install make yum -y install python-devel
それでも無理なら
pip install --upgrade pip pip install --upgrade setuptools
でpipを最新にしてみてはいかがでしょう。
Apacheの設定
無事にmod_wsgiとmod-wsgi-httpdがインストールされたら、それをApacheの設定ファイルに書き込みます。
LoadModule wsgi_module /usr/lib64/python2.7/site-packages/mod_wsgi/server/mod_wsgi-py27.so WSGIScriptAlias / [プロジェクトパス]/[プロジェクトフォルダ]/wsgi.py WSGIPythonPath [プロジェクトパス] <Directory [プロジェクトパス]/[プロジェクトフォルダ]> <Files wsgi.py> Require all granted </Files> </Directory>
ちなみに、mod_wsgi-py27.soの場所が分からない場合は
find / -name mod_wsgi*so
で探してください。
それと
/usr/lib/oracle/12.2/client64/lib
を作成した後、
ldconfig
の実行も必要みたいです。
発生したエラー群
エラー
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-YAaBOt/mod-wsgi/
yum -y install httpd-devel
エラー
unable to execute gcc: No such file or directory error: command 'gcc' failed with exit status 1 Command "/usr/bin/python2 -u -c "import setuptools, tokenize;file='/tmp/pip-build-5jGrlB/mod-wsgi/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-W0TzKG-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-5jGrlB/mod-wsgi/
yum -y install gcc
エラー
fatal error: Python.h: No such file or directory #include <Python.h> ^ compilation terminated. error: command 'gcc' failed with exit status 1
yum -y install python-devel
アクセスエラー
You don't have permission to access / on this server.
/etc/httpd/logs/error_logを確認してみる。恐らく権限エラーなので権限を与える。
アクセスエラー
[Fri Oct 27 03:38:28.161119 2017] [authz_core:error] [pid 6292] [client ::1:41642] AH01630: client denied by server configuration:
/etc/httpd/conf/httpd.confの記述が間違っている。2.4から記述方法が違っている(Order,Allowじゃなくなってる)ため注意。とのこと。
まとめ
正直、疲れた。