mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-02-23 08:39:57 -05:00
Improve the deployment configuration
This commit is contained in:
parent
489fc7f2b5
commit
1b0333fdd5
55
README.md
55
README.md
@ -30,59 +30,22 @@ Pin-Priority: 10
|
|||||||
Then:
|
Then:
|
||||||
|
|
||||||
```
|
```
|
||||||
# apt install git nginx-light uwsgi uwsgi-plugin-python3 mat2 --no-install-recommends
|
# apt install uwsgi uwsgi-plugin-python3 git mat2
|
||||||
|
# apt install nginx-light # if you prefer nginx
|
||||||
|
# apt install apache2 libapache2-mod-proxy-uwsgi # if you prefer Apache2
|
||||||
# cd /var/www/
|
# cd /var/www/
|
||||||
# git clone https://0xacab.org/jvoisin/mat2-web.git
|
# git clone https://0xacab.org/jvoisin/mat2-web.git
|
||||||
# mkdir ./mat2-web/uploads/
|
# mkdir ./mat2-web/uploads/
|
||||||
# chown -R www-data:www-data ./mat2-web
|
# chown -R www-data:www-data ./mat2-web
|
||||||
```
|
```
|
||||||
|
|
||||||
Since uwsgi isn't fun to configure, feel free to slap this into your
|
Since uwsgi isn't fun to configure, feel free to copy [this file](https://0xacab.org/jvoisin/mat2-web/tree/master/config/uwsgi.config)
|
||||||
`/etc/uwsgi/apps-enabled/mat2-web.ini`:
|
to `/etc/uwsgi/apps-enabled/mat2-web.ini` and [this one](https://0xacab.org/jvoisin/mat2-web/tree/master/config/nginx.config)
|
||||||
|
to `/etc/nginx/site-enabled/mat2-web`.
|
||||||
|
|
||||||
```ini
|
Nginx is the recommended web engine, but you can also use Apache if you prefer,
|
||||||
[uwsgi]
|
by copying [this file](https://0xacab.org/jvoisin/mat2-web/tree/master/config/apache2.config)
|
||||||
module=main
|
to your `/etc/apache2/sites-enabled/mat2-web` file.
|
||||||
chdir = /var/www/mat2-web/
|
|
||||||
callable = app
|
|
||||||
wsgi-file = main.py
|
|
||||||
master = true
|
|
||||||
workers = 1
|
|
||||||
|
|
||||||
uid = www-data
|
|
||||||
gid = www-data
|
|
||||||
|
|
||||||
# kill stalled processes
|
|
||||||
harakiri = 30
|
|
||||||
die-on-term = true
|
|
||||||
|
|
||||||
socket = mat2-web.sock
|
|
||||||
chmod-socket = 774
|
|
||||||
plugins = python3
|
|
||||||
```
|
|
||||||
|
|
||||||
and this into your `/etc/nginx/site-enabled/mat2-web`:
|
|
||||||
|
|
||||||
```nginx
|
|
||||||
location / { try_files $uri @yourapplication; }
|
|
||||||
location @yourapplication {
|
|
||||||
include uwsgi_params;
|
|
||||||
uwsgi_pass unix:/var/www/mat2-web/mat2-web.sock;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Nginx is the recommended web engine, but you can also use Apache if you prefer:
|
|
||||||
|
|
||||||
```
|
|
||||||
apt install apache2 libapache2-mod-proxy-uwsgi
|
|
||||||
```
|
|
||||||
|
|
||||||
and add this to your `/etc/apache2/sites-enabled/mat2-web` in the `virtualhost` block:
|
|
||||||
|
|
||||||
```Apache
|
|
||||||
ProxyPass / unix:/var/www/mat2-web/mat2-web.sock|uwsgi://localhost/
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
Finally, restart `uwsgi` and your web server:
|
Finally, restart `uwsgi` and your web server:
|
||||||
|
|
||||||
|
6
config/apache2.config
Normal file
6
config/apache2.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Listen 80
|
||||||
|
<VirtualHost *:80>
|
||||||
|
DocumentRoot "/var/www/mat2-web/"
|
||||||
|
|
||||||
|
ProxyPass / unix:/var/www/mat2-web/mat2-web.sock|uwsgi://localhost/
|
||||||
|
</VirtualHost>
|
14
config/nginx.config
Normal file
14
config/nginx.config
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
server {
|
||||||
|
server_name _;
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
client_max_body_size 20M;
|
||||||
|
|
||||||
|
root /var/www/mat2-web;
|
||||||
|
|
||||||
|
location / { try_files $uri @yourapplication; }
|
||||||
|
location @yourapplication {
|
||||||
|
include uwsgi_params;
|
||||||
|
uwsgi_pass unix:/var/www/mat2-web/mat2-web.sock;
|
||||||
|
}
|
||||||
|
}
|
19
config/uwsgi.config
Normal file
19
config/uwsgi.config
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
[uwsgi]
|
||||||
|
module=main
|
||||||
|
chdir = /var/www/mat2-web/
|
||||||
|
callable = app
|
||||||
|
wsgi-file = main.py
|
||||||
|
master = true
|
||||||
|
workers = 1
|
||||||
|
|
||||||
|
uid = www-data
|
||||||
|
gid = www-data
|
||||||
|
|
||||||
|
# kill stalled processes
|
||||||
|
harakiri = 30
|
||||||
|
die-on-term = true
|
||||||
|
|
||||||
|
socket = mat2-web.sock
|
||||||
|
chmod-socket = 774
|
||||||
|
plugins = python3
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user