目次
文書の過去の版を表示しています。
uWSGI - WSGI アプリケーションコンテナ
uWSGI は、「ホスティングサービスを構築するためのフルスタックの開発を的とする」ソフトウェアアプリケーションです。プロジェクトでサポートされている最初のプラグインである Web Server Gateway Interface(WSGI; ウィズギー) にちなんで命名されている。
uWSGIは、Cherokee や Nginx などの Web サーバーと組み合わせて Python Web アプリケーションを提供するためによく使用され、uWSGI のネイティブ uwsgi プロトコルを直接サポートする。
uWSGI - Wikipedia より
本家: The uWSGI project — uWSGI 2.0 documentation
ソースコード: GitHub - unbit/uwsgi: uWSGI application server container
dnf によるインストール
$ sudo dnf install uwsgi uwsgi-plugin-python3
メタデータの期限切れの最終確認: 0:00:44 時間前の 2020年04月12日 16時55分24秒 に実施しまし た。 依存関係が解決しました。 ========================================================================================== Package Architecture Version Repository Size ========================================================================================== インストール: uwsgi x86_64 2.0.18-2.fc31 fedora 383 k uwsgi-plugin-python3 x86_64 2.0.18-2.fc31 fedora 78 k 依存関係のインストール: uwsgi-plugin-common x86_64 2.0.18-2.fc31 fedora 46 k トランザクションの概要 ========================================================================================== インストール 3 パッケージ 合計サイズ: 507 k インストール済みのサイズ: 1.2 M これでよろしいですか? [y/N]: y パッケージのダウンロード: [SKIPPED] uwsgi-2.0.18-2.fc31.x86_64.rpm: Already downloaded [SKIPPED] uwsgi-plugin-common-2.0.18-2.fc31.x86_64.rpm: Already downloaded [SKIPPED] uwsgi-plugin-python3-2.0.18-2.fc31.x86_64.rpm: Already downloaded ------------------------------------------------------------------------------------------ 合計 50 MB/s | 507 kB 00:00 トランザクションの確認を実行中 トランザクションの確認に成功しました。 トランザクションのテストを実行中 トランザクションのテストに成功しました。 トランザクションを実行中 準備 : 1/1 scriptletの実行中: uwsgi-2.0.18-2.fc31.x86_64 1/3 インストール中 : uwsgi-2.0.18-2.fc31.x86_64 1/3 scriptletの実行中: uwsgi-2.0.18-2.fc31.x86_64 1/3 Executing systemd post-install tasks インストール中 : uwsgi-plugin-common-2.0.18-2.fc31.x86_64 2/3 インストール中 : uwsgi-plugin-python3-2.0.18-2.fc31.x86_64 3/3 scriptletの実行中: uwsgi-plugin-python3-2.0.18-2.fc31.x86_64 3/3 検証 : uwsgi-2.0.18-2.fc31.x86_64 1/3 検証 : uwsgi-plugin-common-2.0.18-2.fc31.x86_64 2/3 検証 : uwsgi-plugin-python3-2.0.18-2.fc31.x86_64 3/3 インストール済み: uwsgi-2.0.18-2.fc31.x86_64 uwsgi-plugin-common-2.0.18-2.fc31.x86_64 uwsgi-plugin-python3-2.0.18-2.fc31.x86_64 完了しました!
uWSGI Emperor Service の有効化
$ sudo systemctl enable uwsgi
Created symlink /etc/systemd/system/multi-user.target.wants/uwsgi.service → /usr/lib/systemd/system/uwsgi.service.
pip によるインストール
$ pip install uwsgi
Collecting uwsgi Downloading uwsgi-2.0.18.tar.gz (801 kB) |████████████████████████████████| 801 kB 738 kB/s Installing collected packages: uwsgi Running setup.py install for uwsgi ... done Successfully installed uwsgi-2.0.18
Apache 2.4 への mod_uwsgi.so のインストール
$ sudo dnf install httpd-devel $ sudo -s
# cd ~ # curl -O https://raw.githubusercontent.com/unbit/uwsgi/master/apache2/mod_uwsgi.c
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 22715 100 22715 0 0 60251 0 --:--:-- --:--:-- --:--:-- 60251
# apxs -i -a -c mod_uwsgi.c
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -c -o mod_uwsgi.lo mod_uwsgi.c && touch mod_uwsgi.slo mod_uwsgi.c: 関数 ‘uwsgi_handler’ 内: mod_uwsgi.c:572:7: 警告: 真偽値として使われる代入のまわりでは、丸括弧の使用をお勧めします [-Wparentheses] 572 | if (hret = ap_scan_script_header_err_brigade(r, bb, NULL)) { | ^~~~ mod_uwsgi.c: 関数 ‘cmd_uwsgi_force_wsgi_scheme’ 内: mod_uwsgi.c:601:21: 警告: ‘&’ の被演算子内にある比較の周りに小括弧を付けることを推奨します [-Wparentheses] 601 | if (strlen(scheme) < 9 & strlen(scheme) > 0) { | ~~~~~~~~~~~~~~~^~~ mod_uwsgi.c: 関数 ‘cmd_uwsgi_max_vars’ 内: mod_uwsgi.c:614:13: 警告: 使用されない変数 ‘val’ です [-Wunused-variable] 614 | int val ; | ^~~ mod_uwsgi.c: 関数 ‘cmd_uwsgi_socket2’ 内: mod_uwsgi.c:705:6: 警告: 真偽値として使われる代入のまわりでは、丸括弧の使用をお勧めします [-Wparentheses] 705 | if (tcp_port = strchr(path, ':')) { | ^~~~~~~~ mod_uwsgi.c: 関数 ‘cmd_uwsgi_socket’ 内: mod_uwsgi.c:738:6: 警告: 真偽値として使われる代入のまわりでは、丸括弧の使用をお勧めします [-Wparentheses] 738 | if (tcp_port = strchr(path, ':')) { | ^~~~~~~~ /usr/lib64/apr-1/build/libtool --silent --mode=link gcc -Wl,-z,relro,-z,now -o mod_uwsgi.la -rpath /usr/lib64/httpd/modules -module -avoid-version mod_uwsgi.lo /usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_uwsgi.la /usr/lib64/httpd/modules /usr/lib64/apr-1/build/libtool --mode=install install mod_uwsgi.la /usr/lib64/httpd/modules/ libtool: install: install .libs/mod_uwsgi.so /usr/lib64/httpd/modules/mod_uwsgi.so libtool: install: install .libs/mod_uwsgi.lai /usr/lib64/httpd/modules/mod_uwsgi.la libtool: install: install .libs/mod_uwsgi.a /usr/lib64/httpd/modules/mod_uwsgi.a libtool: install: chmod 644 /usr/lib64/httpd/modules/mod_uwsgi.a libtool: install: ranlib /usr/lib64/httpd/modules/mod_uwsgi.a libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/lib64/httpd/modules ---------------------------------------------------------------------- Libraries have been installed in: /usr/lib64/httpd/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the '-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the 'LD_RUN_PATH' environment variable during linking - use the '-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to '/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- chmod 755 /usr/lib64/httpd/modules/mod_uwsgi.so
# chmod 755 /usr/lib64/httpd/modules/mod_uwsgi.so # vi /etc/httpd/conf/httpd.conf
- /etc/httpd/conf/httpd.conf
# # Dynamic Shared Object (DSO) Support # # To be able to use the functionality of a module which was built as a DSO you # have to place corresponding `LoadModule' lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by `httpd -l') do not need # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule uwsgi_module modules/mod_uwsgi.so Include conf.modules.d/*.conf