VPS の
前提
OS、
OS
cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)
Apache の
Version apachectl -v Server version: Apache/2.4.29 (CentOS) Server built: Oct 23 2017 14:34:32
Python の
Version python3.6 -V Python 3.6.4
サーバ起動時に、 bad group name xxxxxxxx が 発生する
wsgi のwsgi.conf
に
httpd[20990]: AH00544: httpd: bad group name xxxxxxxx systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE systemd[1]: Failed to start The Apache HTTP Server.
これは、WSGIDaemonProcess
の
以下記載内容に
WSGIDaemonProcess name user=user_name group=group_name python-path=/usr/lib64/python3.6/site-packages
対象の
# グループを追加 groupadd group_name # 対象ユーザーを group を設定する usermod -g group_name user_name
Linux コマンドは
* Linux ユーザ情報の
WSGI process group not yet configured.
グループ設定後に
AH00526: Syntax error on line 10 of /etc/httpd/conf.d/wsgi.conf: WSGI process group not yet configured. httpd.service: main process exited, code=exited, status=1/FAILURE
これは、WSGIScriptAlias
がWSGIDaemonProcess
よりの
WSGIScriptAlias / /var/www/wsgi.py process-group=group_name application-group=%{GLOBAL} WSGIDaemonProcess name user=user_name group=group_name python-path=/usr/lib64/python3.6/site-packages
WSGIScriptAlias
のWSGIDaemonProcess
の
WSGIDaemonProcess name user=user_name group=group_name python-path=/usr/lib64/python3.6/site-packages WSGIScriptAlias / /var/www/wsgi.py process-group=group_name application-group=%{GLOBAL}
全角を 含む URL の ページ表示時に UnicodeEncodeError が 発生する
全角を
return origin.loader.get_contents(origin) File "/usr/lib64/python3.6/site-packages/django/template/loaders/filesystem.py", line 24, in get_contents with io.open(origin.name, encoding=self.engine.file_charset) as fp: UnicodeEncodeError: 'ascii' codec can't encode character '\\u306b' in position 62: ordinal not in range(128)
Apache 経由で
WSGIDaemonProcess
でユーザの
.bashrc
でデフォルトのWSGIDaemonProcess
に、lang
パラメータを
WSGIDaemonProcess name user=user_name group=group_name python-path=/usr/lib64/python3.6/site-packages lang=ja_JP.utf8
または、/etc/sysconfig/httpd
に
LANG='ja_JP.UTF-8'
HTTPD_LANG
をHTTPD_LANG='ja_JP.UTF-8'
WSGIDaemonProcess に
Apache の
Django を 使っている 場合、 400 bad request に なる 場合は、 ALLOWED_HOSTS の 設定を 疑った ほうが いい
Django 、400 bad request
が
Apache のALLOWED_HOSTS
に、
settings.py
にDEBUG = True
のALLOWED_HOSTS
に
以下の
アプリケーションに
以上です。
コメント