« Nginx uWSGI and Ubuntu » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
Aucun résumé des modifications |
|||
Ligne 45 : | Ligne 45 : | ||
plugins = 0:cgi | plugins = 0:cgi | ||
cgi = /usr/lib/cgit/cgit.cgi | cgi = /usr/lib/cgit/cgit.cgi | ||
</filebox> | |||
= Systemd = | |||
== [https://uwsgi-docs.readthedocs.io/en/latest/Systemd.html#one-service-per-app-in-systemd One service per app in systemd] == | |||
<filebox fn='/etc/systemd/system/uwsgi-app@.socket' lang='ini'> | |||
[Unit] | |||
Description=Socket for uWSGI app %i | |||
[Socket] | |||
ListenStream=/var/run/uwsgi/%i.socket | |||
SocketUser=www-%i | |||
SocketGroup=www-data | |||
SocketMode=0660 | |||
[Install] | |||
WantedBy=sockets.target | |||
</filebox> | |||
<filebox fn='/etc/systemd/system/uwsgi-app@.service' lang='ini'> | |||
[Unit] | |||
Description=%i uWSGI app | |||
After=syslog.target | |||
[Service] | |||
ExecStart=/usr/bin/uwsgi \ | |||
--ini /etc/uwsgi/apps-available/%i.ini \ | |||
--socket /var/run/uwsgi/%i.socket | |||
User=www-%i | |||
Group=www-data | |||
Restart=on-failure | |||
KillSignal=SIGQUIT | |||
Type=notify | |||
StandardError=syslog | |||
NotifyAccess=all | |||
</filebox> | </filebox> |
Version du 9 août 2023 à 15:32
Install
ai nginx uwsgi-plugin-php # check nginx is running sc-status nginx |
With Ubuntu 20.04, ondrej ppa and PHP 8.2 installed, the following dependencies are wrongly installed: php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-phpdbg php7.4-readline |
Site configuration
# enable a web site sudo ln -s /etc/uwsgi/apps-available/phpinfo.conf /etc/uwsgi/apps-enabled/phpinfo.conf sc-restart nginx |
phpinfo
/etc/nginx/sites-available/phpinfo.conf |
server { listen 80; root /var/www/php; index info.php; server_name phpinfo.net; location ~ \.php$ { include uwsgi_params; uwsgi_modifier1 14; uwsgi_pass 127.0.0.1:3030; } } |
/etc/uwsgi/apps-available/phpinfo.ini |
[uwsgi] master = True cheap = True idle = 600 die-on-idle = True # If app is not used often, it will exit and be launched again by systemd requested by users. manage-script-name = True plugins = 0:cgi cgi = /usr/lib/cgit/cgit.cgi |
Systemd
One service per app in systemd
/etc/systemd/system/uwsgi-app@.socket |
[Unit] Description=Socket for uWSGI app %i [Socket] ListenStream=/var/run/uwsgi/%i.socket SocketUser=www-%i SocketGroup=www-data SocketMode=0660 [Install] WantedBy=sockets.target |
/etc/systemd/system/uwsgi-app@.service |
[Unit] Description=%i uWSGI app After=syslog.target [Service] ExecStart=/usr/bin/uwsgi \ --ini /etc/uwsgi/apps-available/%i.ini \ --socket /var/run/uwsgi/%i.socket User=www-%i Group=www-data Restart=on-failure KillSignal=SIGQUIT Type=notify StandardError=syslog NotifyAccess=all |