This problem took about one afternoon.
Previously, a uliweb application was executed using a user identity. At that time, the uliweb debugging server was used for laziness and then managed using the supervisor. However, it was found that the uliweb debugging server could not be suspended using the supervisor.
Later I remembered that wsgidaemonprocess (mod_wsgi's Apache Directive) had the user group parameter. Therefore, mod_wsgi can be configured as a demon process for execution using a user identity, but there was a problem in trying it out, it is found that although wsgidaemonprocess configures the user group, it still seems that the default user www-data is used for execution. Finally, you can see that there is
Also
Wsgiprocessgroup, just add this configuration.
The specific configuration example is as follows. For example, I want to configure an application MyApp to run on port 2005 of the server using the identity of the user demon,
First, modify/etc/apache2/ports. conf and add:
Namevirtualhost*: 2005
Listen 2005.
Modify/etc/apache2/httpd. conf and add:
<Virtualhost *: 2005>
Servername your_server_name
Wsgidaemonprocess your_server_name user = daemon group = daemon processes = 2 threads = 5
Wsgiprocessgroup your_server_name
Wsgiscriptalias // home/daemon/MyApp/wsgi_handler.py
Errorlog/var/log/apache2/myapp-error_log
Customlog/var/log/apache2/myapp-access_log common
</Virtualhost>
That's all.
However, the strange thing is that, according to the test I used print> SYS. stderr and OS. Environ, I found that www-data was used, but it still works normally.