From cd3eb0e07cc38651ba9fd1efc954f220a167eec0 Mon Sep 17 00:00:00 2001 From: Alexander Schulz Date: Fri, 30 Aug 2024 23:40:20 +0200 Subject: [PATCH] added gunicorn service socket and nginx config. --- gunicorn.service | 18 ++++++++++++++++++ gunicorn.socket | 9 +++++++++ testapp.nginx | 20 ++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 gunicorn.service create mode 100644 gunicorn.socket create mode 100644 testapp.nginx diff --git a/gunicorn.service b/gunicorn.service new file mode 100644 index 0000000..20e5529 --- /dev/null +++ b/gunicorn.service @@ -0,0 +1,18 @@ +#cp to /etc/systemd/system/gunicorn.service +[Unit] +Description=gunicorn daemon +Requires=gunicorn.socket +After=network.target + +[Service] +User=root +Group=www-data +WorkingDirectory=/root/appdirectory/ +ExecStart=/root/appdirectory/testappenv/bin/gunicorn \ + --access-logfile - \ + --workers 3 \ + --bind unix:/run/gunicorn.sock \ + testapp.wsgi:application + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/gunicorn.socket b/gunicorn.socket new file mode 100644 index 0000000..2cb37bc --- /dev/null +++ b/gunicorn.socket @@ -0,0 +1,9 @@ +#cp to /etc/systemd/system/gunicorn.socket +[Unit] +Description=gunicorn socket + +[Socket] +ListenStream=/run/gunicorn.sock + +[Install] +WantedBy=sockets.target \ No newline at end of file diff --git a/testapp.nginx b/testapp.nginx new file mode 100644 index 0000000..6c8e91d --- /dev/null +++ b/testapp.nginx @@ -0,0 +1,20 @@ +#copy to /etc/nginx/sites-available +#link to: ln -s /etc/nginx/sites-available/testapp /etc/nginx/sites-enabled/ +#nginx -t +# sytemctl restart nginx + +server { + listen 80; + server_name develop.artemisneo.com; + + location = /favicon.ico { access_log off; log_not_found off; } + + location /static/ { + root /root/appdirectory/assets; + } + location / { + include proxy_params; + proxy_pass http://unix:/run/gunicorn.sock; + } + +}