你在哪里创建ini文件? (Uwsgi)

Where do you create the ini file? (Uwsgi)

我的参考:
https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/uwsgi/

我的项目名称:
'mysite'

我的目录:

我创造'uwsgi.ini'.

然后,我在ini文件里写了

[uwsgi]
chdir=/var/www/html/portfolio/mysite
module=mysite.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi/yourproject.log
single-interpreter=True

那么,我命令'service apache2 restart'

我命令这个'uwsgi --ini uwsgi.ini'

# uwsgi --ini uwsgi.ini
# open("/var/log/uwsgi/yourproject.log"): No such file or directory [core/logging.c line 288]

参考资料(日语)

Ubuntu server fails

(console)
# pip3 install uwsgi
  Installing collected packages: uwsgi
  Successfully installed uwsgi-2.0.20
# mkdir -p /etc/uwsgi/vassals
# cd /etc/uwsgi/vassals
# source /var/www/html/venv/bin/activate

# vi uwsgi.ini
(uwsgi.ini(new))
[uwsgi]
chdir=/var/www/html/portfolio/mysite
module=mysite.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
daemonize=/var/log/uwsgi/uwsgi.log
single-interpreter=True
(console)
# adduser --group uwsgi-data
# adduser --home /etc/uwsgi --no-create-home --shell /sbin/nologin --ingroup uwsgi-data --disabled-login uwsgi-data
  Adding user `uwsgi-data' ...
  Adding new user `uwsgi-data' (1001) with group `uwsgi-data' ...
  Not creating home directory `/etc/uwsgi'.
  Changing the user information for uwsgi-data
  Enter the new value, or press ENTER for the 
  default
        Full Name []:  # Empty and OK
        Room Number []:
        Work Phone []:
        Home Phone []:
        Other []:
  Is the information correct? [Y/n] Y
(console)
# chown -R uwsgi-data:uwsgi-data /etc/uwsgi
# mkdir /var/log/uwsgi
# chown -R uwsgi-data:uwsgi-data /var/log/uwsgi
# vi /etc/systemd/system/emperor.uwsgi.service
(emperor.uwsgi.service)
[Unit]
Description=uWSGI Emperor
After=syslog.service

[Service]
# Find the configuration file that exists in "/etc/uwsgi/vassals" and start the uWSGI daemon.
ExecStart=/var/www/html/venv/bin/uwsgi --master --emperor /etc/uwsgi/vassals
RuntimeDirectory=uwsgi
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all

[Install]
WantedBy=multi-user.target
(console)
# chmod 755 /etc/systemd/system/emperor.uwsgi.service
# vi /etc/uwsgi/vassals/emperor.ini
(emperor.ini)
[uwsgi]
emperor = /etc/uwsgi/vassals
uid = uwsgi-data
gid = uwsgi-data
(console)
# systemctl start emperor.uwsgi.service
# systemctl status emperor.uwsgi.service
  ● emperor.uwsgi.service - uWSGI Emperor
     Loaded: loaded (/etc/systemd/system/emperor.uwsgi.service; disabled; vendor preset: enabled)
     Active: active (running)

# service apache2 restart