Hello.
I have a working Django project
which can be run by its own http-server
using
"./manage.py runserver 0.0.0.0:8000"
One of the apps is available then on
"http://192.168.1.102:8000/it"
The same project can be run using uwsgi's own
http server by adding the option
"http-socket = :8000"
to the uwsgi.ini file:
The whole file is:
[uwsgi]
fastcgi-socket = 127.0.0.1:3031
http-socket = :8000
chdir = /home/someuser/DJANGO/main_site/
wsgi-file = main_site/wsgi.py
master = True
max-requests = 5000
processes = 2
threads = 2
stats = 127.0.0.1:9191
venv = /home/someuser/work_env
touch-reload = /home/someuser/DJANGO/main_site/reload
safe-pidfile2 = /home/someuser/DJANGO/main_site/uwsgi.pid
logto2 = /tmp/uwsgi.log
vacuum = True
# daemonize = yes
I was able to set up OpenBSD httpd to serve
Django applications two years ago.
I lost httpd.conf file which was working for me
but it did not seem too much complicated.
Now I try to reproduce my setup by using the
simplest httpd.conf:
server "192.168.1.102" {
listen on * port 8000
fastcgi socket ":3031"
}
Now I start uwsgi after commenting out the option "http-socket = :8000"
and it is ready to serve on 127.0.0.1:3031:
someuser$ uwsgi uwsgi.ini
[uWSGI] getting INI configuration from uwsgi.ini
*** Starting uWSGI 2.0.19.1 (64bit) on [Mon Dec 21 13:25:29 2020] ***
compiled with version: OpenBSD Clang 10.0.1 on 21 December 2020 07:54:16
os: OpenBSD-6.8 GENERIC#1
nodename: somewebserver
machine: amd64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /home/someuser/DJANGO/main_site
detected binary path: uwsgi
and its log:
chdir() to /home/someuser/DJANGO/main_site/
your processes number limit is 256
your memory page size is 4096 bytes
detected max file descriptor number: 512
lock engine: ipcsem
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 3.8.6 (default, Oct 13 2020, 09:04:17) [Clang 10.0.1 ]
PEP 405 virtualenv detected: /home/someuser/work_env
Set PythonHome to /home/someuser/work_env
Python main interpreter initialized at 0xa81c55ec00
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 250080 bytes (244 KB) for 4 cores
*** Operational MODE: preforking+threaded ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter
0xa81c55ec00 pid: 89605 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 89605)
spawned uWSGI worker 1 (pid: 70095, cores: 2)
writing pidfile to /home/someuser/DJANGO/main_site/uwsgi.pid
spawned uWSGI worker 2 (pid: 17757, cores: 2)
writing pidfile to /home/someuser/DJANGO/main_site/uwsgi.pid
writing pidfile to /home/someuser/DJANGO/main_site/uwsgi.pid
*** Stats server enabled on 127.0.0.1:9191 fd: 11 ***
And this is what httpd shows:
user$ httpd -dvvvv
startup
socket_rlimit: max open files 1024
socket_rlimit: max open files 1024
socket_rlimit: max open files 1024
server_privinit: adding server 192.168.1.102
server_privinit: adding server 192.168.1.102
server_launch: configuring server 192.168.1.102
server_launch: configuring server 192.168.1.102
server_launch: running server 192.168.1.102
server_launch: configuring server 192.168.1.102
server_launch: running server 192.168.1.102
server_launch: running server 192.168.1.102
server_launch: configuring server 192.168.1.102
server_launch: running server 192.168.1.102
server_launch: configuring server 192.168.1.102
server_launch: running server 192.168.1.102
server_launch: configuring server 192.168.1.102
server_launch: running server 192.168.1.102
Then I try to access http://192.168.1.102:8000/it/
And than httpd shows:
192.168.1.102 192.168.1.57 - - [21/Dec/2020:13:33:21 +0300] "GET /it/
HTTP/1.1"
500 0
server 192.168.1.102, client 1 (1 active), 192.168.1.57:34196 ->
192.168.1.102:8
000, No such file or directory (500 Internal Server Error)
No change on uwsgi.log
No change on uwsgi stdout
netstat -naf inet
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp 0 0 127.0.0.1.3031 *.* LISTEN
tcp 0 0 *.8000 *.* LISTEN
httpd does not seem to use the fastcgi socket it is pointed to
or is it my annoying mistake?
--
Best regards
Maksim Rodin