========================================================================================================
Package アーキテクチャー バージョン リポジトリー 容量
========================================================================================================
インストール中:
httpd-devel x86_64 2.4.6-67.el7.centos.6 updates 194 k
mod_wsgi x86_64 3.4-12.el7_0 base 76 k
依存性関連でのインストールをします:
apr-devel x86_64 1.4.8-3.el7 base 188 k
apr-util-devel x86_64 1.5.2-6.el7 base 76 k
cyrus-sasl-devel x86_64 2.1.26-21.el7 base 310 k
libdb-devel x86_64 5.3.21-20.el7 base 38 k
openldap-devel x86_64 2.4.44-5.el7 base 801 k
[root@SAKURA_VPS yum.repos.d]# yum search python3 | grep devel python34-greenlet-devel.x86_64 : C development headers for python34-greenlet python34-devel.x86_64 : Libraries and header files needed for Python 3
: development python34u-devel.x86_64 : Libraries and header files needed for Python 3
: development python35u-devel.x86_64 : Libraries and header files needed for Python 3
: development python36u-devel.x86_64 : Libraries and header files needed for Python
: development
[root@SAKURA_VPS yum.repos.d]#
総ダウンロード容量: 839 k
インストール容量: 2.6 M
Is this ok [y/d/N]: y
Downloading packages:
python36u-devel-3.6.3-1.ius.centos7.x86_64.rpm | 839 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
インストール中 : python36u-devel-3.6.3-1.ius.centos7.x86_64 1/1
検証中 : python36u-devel-3.6.3-1.ius.centos7.x86_64 1/1
[root@SAKURA_VPS conf]# pwd /etc/httpd/conf
[root@SAKURA_VPS conf]# vi httpd.conf
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
~ 省略 ~
# Django & wsgi & Apache連携 LoadModule /home/test/pyenv/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so WSGIScriptAlias / /home/test/pyenv/todo/todo/wsgi.py WSGIPythonPath /home/test/pyenv/todo WSGIPythonPath /home/test/pyenv/lib/python3.6/site-packages <Directory /home/test/pyenv/todo/todo> <Files wsgi.py> Order deny,allow Allow from all </Files> </Directory>
Apacheを起動する
Apacheを起動したところ、エラーになりました。
以下のエラーメッセージです。
「httpd: Syntax error on line 359 of /etc/httpd/conf/httpd.conf: LoadModule takes two arguments, a module name and the name of a shared object file to load it from」
シンタックスエラーです。
エラー内容を見ると「wsgi」を2回ロードモジュールしていると読めます。
[root@SAKURA_VPS conf]# systemctl restart httpd.service
Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details.
[root@SAKURA_VPS conf]# systemctl status httpd.service -l ● httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 日 2017-11-12 21:46:18 JST; 28s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 12321 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 12319 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 12319 (code=exited, status=1/FAILURE)
11月 12 21:46:18 tk2-250-34861.vs.sakura.ne.jp systemd[1]: Starting The Apache HTTP Server…
11月 12 21:46:18 tk2-250-34861.vs.sakura.ne.jp httpd[12319]: httpd: Syntax error on line 359 of /etc/httpd/conf/httpd.conf: LoadModule takes two arguments, a module name and the name of a shared object file to load it from
11月 12 21:46:18 tk2-250-34861.vs.sakura.ne.jp systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
11月 12 21:46:18 tk2-250-34861.vs.sakura.ne.jp kill[12321]: kill: cannot find process “”
11月 12 21:46:18 tk2-250-34861.vs.sakura.ne.jp systemd[1]: httpd.service: control process exited, code=exited status=1
11月 12 21:46:18 tk2-250-34861.vs.sakura.ne.jp systemd[1]: Failed to start The Apache HTTP Server.
11月 12 21:46:18 tk2-250-34861.vs.sakura.ne.jp systemd[1]: Unit httpd.service entered failed state.
11月 12 21:46:18 tk2-250-34861.vs.sakura.ne.jp systemd[1]: httpd.service failed.
[root@SAKURA_VPS conf]#
一旦httpd.confからwsgiのロードモジュールをコメントアウトしました。
[root@SAKURA_VPS conf]# vi httpd.conf
~ 省略 ~
# Django & wsgi & Apache連携 #LoadModule /home/test/pyenv/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so ← コメントアウトをします。
WSGIScriptAlias / /home/test/pyenv/todo/todo/wsgi.py
WSGIPythonPath /home/test/pyenv/todo
WSGIPythonPath /home/test/pyenv/lib/python3.6/site-packages
<Directory /home/test/pyenv/todo/todo>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
11月 12 21:56:54 tk2-250-34861.vs.sakura.ne.jp systemd[1]: Starting The Apache HTTP Server…
11月 12 21:56:55 tk2-250-34861.vs.sakura.ne.jp systemd[1]: Started The Apache HTTP Server.
しかしブラウザを起動し「http://127.0.0.1/todo_app」にアクセスをすると「https://127.0.0.1/todo_app」にリダイレクトされて下図のように「Forbidden You don’t have paermission to access /todo_app on this server.」と表示されてエラーになります。
切り分け調査のため、「https://127.0.0.1/」にアクセスしてみます。
「https://127.0.0.1」へのアクセスは問題なさそうです。
エラーログの確認
エラーログを確認します。
[root@SAKURA_VPS logs]# pwd /etc/httpd/logs
[root@SAKURA_VPS logs]# tail -n 100 error_log
[Mon Nov 13 08:13:00.966637 2017] [proxy:debug] [pid 22167] proxy_util.c(1843): AH00925: initializing worker proxy:reverse shared
[Mon Nov 13 08:13:00.967099 2017] [proxy:debug] [pid 22167] proxy_util.c(1885): AH00927: initializing worker proxy:reverse local
[Mon Nov 13 08:13:00.967161 2017] [proxy:debug] [pid 22167] proxy_util.c(1936): AH00931: initialized single connection worker in child 22167 for (*)
[Mon Nov 13 08:13:00.968095 2017] [:info] [pid 22167] mod_wsgi (pid=22167): Initializing Python.
[Mon Nov 13 08:13:01.004685 2017] [:info] [pid 22167] mod_wsgi (pid=22167): Attach interpreter ”.
[Mon Nov 13 08:13:01.004828 2017] [:info] [pid 22167] mod_wsgi (pid=22167): Adding ‘/home/test/pyenv/lib/python3.6/site-packages’ to path.
[Mon Nov 13 08:14:52.215467 2017] [core:info] [pid 22154] AH00096: removed PID file /run/httpd/httpd.pid (pid=22154)
[Mon Nov 13 08:14:52.215817 2017] [:info] [pid 22155] mod_wsgi (pid=22155): Destroying interpreters.
[Mon Nov 13 08:14:52.215909 2017] [:info] [pid 22155] mod_wsgi (pid=22155): Cleanup interpreter ”.
[Mon Nov 13 08:14:52.216313 2017] [:info] [pid 22159] mod_wsgi (pid=22159): Destroying interpreters.
[Mon Nov 13 08:14:52.216368 2017] [:info] [pid 22159] mod_wsgi (pid=22159): Cleanup interpreter ”.
[Mon Nov 13 08:14:52.216670 2017] [:info] [pid 22158] mod_wsgi (pid=22158): Destroying interpreters.
[Mon Nov 13 08:14:52.216721 2017] [:info] [pid 22158] mod_wsgi (pid=22158): Cleanup interpreter ”.
[Mon Nov 13 08:14:52.217329 2017] [:info] [pid 22156] mod_wsgi (pid=22156): Destroying interpreters.
[Mon Nov 13 08:14:52.217384 2017] [:info] [pid 22156] mod_wsgi (pid=22156): Cleanup interpreter ”.
[Mon Nov 13 08:14:52.218937 2017] [:info] [pid 22167] mod_wsgi (pid=22167): Destroying interpreters.
[Mon Nov 13 08:14:52.218989 2017] [:info] [pid 22167] mod_wsgi (pid=22167): Cleanup interpreter ”.
[Mon Nov 13 08:14:52.220350 2017] [:info] [pid 22157] mod_wsgi (pid=22157): Destroying interpreters.
[Mon Nov 13 08:14:52.220399 2017] [:info] [pid 22157] mod_wsgi (pid=22157): Cleanup interpreter ”.
[Mon Nov 13 08:14:52.215728 2017] [mpm_prefork:notice] [pid 22154] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Nov 13 08:14:52.385268 2017] [:info] [pid 22158] mod_wsgi (pid=22158): Terminating Python.
[Mon Nov 13 08:14:52.387676 2017] [:info] [pid 22156] mod_wsgi (pid=22156): Terminating Python.
[Mon Nov 13 08:14:52.389848 2017] [:info] [pid 22156] mod_wsgi (pid=22156): Python has shutdown.
[Mon Nov 13 08:14:52.396102 2017] [:info] [pid 22159] mod_wsgi (pid=22159): Terminating Python.
[Mon Nov 13 08:14:52.398313 2017] [:info] [pid 22159] mod_wsgi (pid=22159): Python has shutdown.
[Mon Nov 13 08:14:52.403377 2017] [:info] [pid 22167] mod_wsgi (pid=22167): Terminating Python.
[Mon Nov 13 08:14:52.405550 2017] [:info] [pid 22167] mod_wsgi (pid=22167): Python has shutdown.
[Mon Nov 13 08:14:52.410959 2017] [:info] [pid 22157] mod_wsgi (pid=22157): Terminating Python.
[Mon Nov 13 08:14:52.414020 2017] [:info] [pid 22157] mod_wsgi (pid=22157): Python has shutdown.
[Mon Nov 13 08:14:52.418550 2017] [:info] [pid 22155] mod_wsgi (pid=22155): Terminating Python.
[Mon Nov 13 08:14:52.420728 2017] [:info] [pid 22155] mod_wsgi (pid=22155): Python has shutdown.
[Mon Nov 13 08:14:52.427524 2017] [:info] [pid 22158] mod_wsgi (pid=22158): Python has shutdown.
[Mon Nov 13 08:14:53.320075 2017] [suexec:notice] [pid 22293] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Nov 13 08:14:53.320498 2017] [ssl:debug] [pid 22293] ssl_engine_pphrase.c(181): AH02199: SSL not enabled on vhost tk2-250-34861.vs.sakura.ne.jp:80, skipping SSL setup
[Mon Nov 13 08:14:53.320970 2017] [ssl:debug] [pid 22293] ssl_engine_pphrase.c(239): AH02202: Init: Read server certificate from ‘/etc/letsencrypt/live/box-cm.com/cert.pem’
[Mon Nov 13 08:14:53.321368 2017] [ssl:info] [pid 22293] AH01887: Init: Initializing (virtual) servers for SSL
[Mon Nov 13 08:14:53.322118 2017] [ssl:info] [pid 22293] AH01876: mod_ssl/2.4.6 compiled against Server: Apache/2.4.6, Library: OpenSSL/1.0.2k
[Mon Nov 13 08:14:53.355839 2017] [auth_digest:notice] [pid 22293] AH01757: generating secret for digest authentication …
[Mon Nov 13 08:14:53.355871 2017] [auth_digest:debug] [pid 22293] mod_auth_digest.c(250): AH01759: done
[Mon Nov 13 08:14:53.356497 2017] [slotmem_shm:debug] [pid 22293] mod_slotmem_shm.c(448): AH02301: attach looking for /run/httpd/slotmem-shm-mod_heartmonitor.shm
[Mon Nov 13 08:14:53.356519 2017] [lbmethod_heartbeat:notice] [pid 22293] AH02282: No slotmem from mod_heartmonitor
[Mon Nov 13 08:14:53.356602 2017] [ssl:debug] [pid 22293] ssl_engine_pphrase.c(181): AH02199: SSL not enabled on vhost tk2-250-34861.vs.sakura.ne.jp:80, skipping SSL setup
[Mon Nov 13 08:14:53.356729 2017] [ssl:debug] [pid 22293] ssl_engine_pphrase.c(239): AH02202: Init: Read server certificate from ‘/etc/letsencrypt/live/box-cm.com/cert.pem’
[Mon Nov 13 08:14:53.356894 2017] [socache_shmcb:debug] [pid 22293] mod_socache_shmcb.c(391): AH00821: shmcb_init allocated 512000 bytes of shared memory
[Mon Nov 13 08:14:53.356904 2017] [socache_shmcb:debug] [pid 22293] mod_socache_shmcb.c(407): AH00822: for 511912 bytes (512000 including header), recommending 32 subcaches, 88 indexes each
[Mon Nov 13 08:14:53.356906 2017] [socache_shmcb:debug] [pid 22293] mod_socache_shmcb.c(440): AH00824: shmcb_init_memory choices follow
[Mon Nov 13 08:14:53.356908 2017] [socache_shmcb:debug] [pid 22293] mod_socache_shmcb.c(442): AH00825: subcache_num = 32
[Mon Nov 13 08:14:53.356910 2017] [socache_shmcb:debug] [pid 22293] mod_socache_shmcb.c(444): AH00826: subcache_size = 15992
[Mon Nov 13 08:14:53.356911 2017] [socache_shmcb:debug] [pid 22293] mod_socache_shmcb.c(446): AH00827: subcache_data_offset = 2128
[Mon Nov 13 08:14:53.356913 2017] [socache_shmcb:debug] [pid 22293] mod_socache_shmcb.c(448): AH00828: subcache_data_size = 13864
[Mon Nov 13 08:14:53.356915 2017] [socache_shmcb:debug] [pid 22293] mod_socache_shmcb.c(450): AH00829: index_num = 88
[Mon Nov 13 08:14:53.356988 2017] [socache_shmcb:info] [pid 22293] AH00830: Shared memory socache initialised
[Mon Nov 13 08:14:53.356992 2017] [ssl:info] [pid 22293] AH01887: Init: Initializing (virtual) servers for SSL
[Mon Nov 13 08:14:53.357403 2017] [ssl:info] [pid 22293] AH01876: mod_ssl/2.4.6 compiled against Server: Apache/2.4.6, Library: OpenSSL/1.0.2k [Mon Nov 13 08:14:53.383329 2017] [mpm_prefork:notice] [pid 22293] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.4.16 mod_wsgi/3.4 Python/2.7.5 configured — resuming normal operations ← Python 3.6 ではなく Python 2.7.5 を使っている?
[Mon Nov 13 08:14:53.383367 2017] [mpm_prefork:info] [pid 22293] AH00164: Server built: Oct 19 2017 20:39:16
[Mon Nov 13 08:14:53.383387 2017] [core:notice] [pid 22293] AH00094: Command line: ‘/usr/sbin/httpd -D FOREGROUND’
[Mon Nov 13 08:14:53.383403 2017] [mpm_prefork:debug] [pid 22293] prefork.c(1005): AH00165: Accept mutex: sysvsem (default: sysvsem)
[Mon Nov 13 08:14:53.395954 2017] [proxy:debug] [pid 22298] proxy_util.c(1843): AH00925: initializing worker proxy:reverse shared
[Mon Nov 13 08:14:53.395989 2017] [proxy:debug] [pid 22298] proxy_util.c(1885): AH00927: initializing worker proxy:reverse local
[Mon Nov 13 08:14:53.396017 2017] [proxy:debug] [pid 22298] proxy_util.c(1936): AH00931: initialized single connection worker in child 22298 for (*)
[Mon Nov 13 08:14:53.396052 2017] [:info] [pid 22298] mod_wsgi (pid=22298): Initializing Python.
[Mon Nov 13 08:14:53.399181 2017] [proxy:debug] [pid 22294] proxy_util.c(1843): AH00925: initializing worker proxy:reverse shared
[Mon Nov 13 08:14:53.399211 2017] [proxy:debug] [pid 22294] proxy_util.c(1885): AH00927: initializing worker proxy:reverse local
[Mon Nov 13 08:14:53.399237 2017] [proxy:debug] [pid 22294] proxy_util.c(1936): AH00931: initialized single connection worker in child 22294 for (*)
[Mon Nov 13 08:14:53.399271 2017] [:info] [pid 22294] mod_wsgi (pid=22294): Initializing Python.
[Mon Nov 13 08:14:53.402086 2017] [proxy:debug] [pid 22295] proxy_util.c(1843): AH00925: initializing worker proxy:reverse shared
[Mon Nov 13 08:14:53.402139 2017] [proxy:debug] [pid 22295] proxy_util.c(1885): AH00927: initializing worker proxy:reverse local
[Mon Nov 13 08:14:53.402176 2017] [proxy:debug] [pid 22295] proxy_util.c(1936): AH00931: initialized single connection worker in child 22295 for (*)
[Mon Nov 13 08:14:53.402211 2017] [:info] [pid 22295] mod_wsgi (pid=22295): Initializing Python.
[Mon Nov 13 08:14:53.405272 2017] [proxy:debug] [pid 22296] proxy_util.c(1843): AH00925: initializing worker proxy:reverse shared
[Mon Nov 13 08:14:53.405298 2017] [proxy:debug] [pid 22296] proxy_util.c(1885): AH00927: initializing worker proxy:reverse local
[Mon Nov 13 08:14:53.405322 2017] [proxy:debug] [pid 22296] proxy_util.c(1936): AH00931: initialized single connection worker in child 22296 for (*)
[Mon Nov 13 08:14:53.405352 2017] [:info] [pid 22296] mod_wsgi (pid=22296): Initializing Python.
[Mon Nov 13 08:14:53.407978 2017] [proxy:debug] [pid 22297] proxy_util.c(1843): AH00925: initializing worker proxy:reverse shared
[Mon Nov 13 08:14:53.408003 2017] [proxy:debug] [pid 22297] proxy_util.c(1885): AH00927: initializing worker proxy:reverse local
[Mon Nov 13 08:14:53.408028 2017] [proxy:debug] [pid 22297] proxy_util.c(1936): AH00931: initialized single connection worker in child 22297 for (*)
[Mon Nov 13 08:14:53.408061 2017] [:info] [pid 22297] mod_wsgi (pid=22297): Initializing Python.
[Mon Nov 13 08:14:53.463200 2017] [:info] [pid 22294] mod_wsgi (pid=22294): Attach interpreter ”.
[Mon Nov 13 08:14:53.463287 2017] [:info] [pid 22294] mod_wsgi (pid=22294): Adding ‘/home/test/pyenv/lib/python3.6/site-packages’ to path.
[Mon Nov 13 08:14:53.464620 2017] [:info] [pid 22297] mod_wsgi (pid=22297): Attach interpreter ”.
[Mon Nov 13 08:14:53.464687 2017] [:info] [pid 22297] mod_wsgi (pid=22297): Adding ‘/home/test/pyenv/lib/python3.6/site-packages’ to path.
[Mon Nov 13 08:14:53.466585 2017] [:info] [pid 22295] mod_wsgi (pid=22295): Attach interpreter ”.
[Mon Nov 13 08:14:53.466685 2017] [:info] [pid 22295] mod_wsgi (pid=22295): Adding ‘/home/test/pyenv/lib/python3.6/site-packages’ to path.
[Mon Nov 13 08:14:53.467813 2017] [:info] [pid 22298] mod_wsgi (pid=22298): Attach interpreter ”.
[Mon Nov 13 08:14:53.467879 2017] [:info] [pid 22298] mod_wsgi (pid=22298): Adding ‘/home/test/pyenv/lib/python3.6/site-packages’ to path.
[Mon Nov 13 08:14:53.468446 2017] [:info] [pid 22296] mod_wsgi (pid=22296): Attach interpreter ”.
[Mon Nov 13 08:14:53.468511 2017] [:info] [pid 22296] mod_wsgi (pid=22296): Adding ‘/home/test/pyenv/lib/python3.6/site-packages’ to path.
[Mon Nov 13 08:14:56.476719 2017] [proxy:debug] [pid 22307] proxy_util.c(1843): AH00925: initializing worker proxy:reverse shared
[Mon Nov 13 08:14:56.476914 2017] [proxy:debug] [pid 22307] proxy_util.c(1885): AH00927: initializing worker proxy:reverse local
[Mon Nov 13 08:14:56.476963 2017] [proxy:debug] [pid 22307] proxy_util.c(1936): AH00931: initialized single connection worker in child 22307 for (*)
[Mon Nov 13 08:14:56.477009 2017] [:info] [pid 22307] mod_wsgi (pid=22307): Initializing Python.
[Mon Nov 13 08:14:56.501528 2017] [:info] [pid 22307] mod_wsgi (pid=22307): Attach interpreter ”.
[Mon Nov 13 08:14:56.501629 2017] [:info] [pid 22307] mod_wsgi (pid=22307): Adding ‘/home/test/pyenv/lib/python3.6/site-packages’ to path.
[Mon Nov 13 12:47:01.859876 2017] [proxy:debug] [pid 6094] proxy_util.c(1843): AH00925: initializing worker proxy:reverse shared
[Mon Nov 13 12:47:01.860273 2017] [proxy:debug] [pid 6094] proxy_util.c(1885): AH00927: initializing worker proxy:reverse local
[Mon Nov 13 12:47:01.860325 2017] [proxy:debug] [pid 6094] proxy_util.c(1936): AH00931: initialized single connection worker in child 6094 for (*)
[Mon Nov 13 12:47:01.860414 2017] [:info] [pid 6094] mod_wsgi (pid=6094): Initializing Python.
[Mon Nov 13 12:47:01.893263 2017] [:info] [pid 6094] mod_wsgi (pid=6094): Attach interpreter ”.
[Mon Nov 13 12:47:01.893371 2017] [:info] [pid 6094] mod_wsgi (pid=6094): Adding ‘/home/test/pyenv/lib/python3.6/site-packages’ to path.
[root@SAKURA_VPS logs]#
11月 13 21:41:38 tk2-250-34861.vs.sakura.ne.jp systemd[1]: Starting The Apache HTTP Server…
11月 13 21:41:38 tk2-250-34861.vs.sakura.ne.jp httpd[6420]: httpd: Syntax error on line 359 of /etc/httpd/conf/httpd.conf: LoadModule takes two arguments, a module name and the name of a shared object file to load it from
11月 13 21:41:38 tk2-250-34861.vs.sakura.ne.jp systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
11月 13 21:41:38 tk2-250-34861.vs.sakura.ne.jp kill[6422]: kill: cannot find process “”
11月 13 21:41:38 tk2-250-34861.vs.sakura.ne.jp systemd[1]: httpd.service: control process exited, code=exited status=1
11月 13 21:41:38 tk2-250-34861.vs.sakura.ne.jp systemd[1]: Failed to start The Apache HTTP Server.
11月 13 21:41:38 tk2-250-34861.vs.sakura.ne.jp systemd[1]: Unit httpd.service entered failed state.
11月 13 21:41:38 tk2-250-34861.vs.sakura.ne.jp systemd[1]: httpd.service failed.
[root@SAKURA_VPS ~]#
コメント