Deploying to production¶
Linux Mint 19 (Ubuntu bionic)¶
- Installing nginx
- $sudo apt install nginx
- Installing uwsgi (on virtualenv django_ocr_server)
- $pip install uwsgi
- Create {path_to_your_project}/uwsgi.ini
- Create /etc/nginx/sites-available/django_ocr_server.conf
- Enable the django_ocr_server site
- $sudo ln -s /etc/nginx/sites-available/django_ocr_server.conf /etc/nginx/sites-enabled/
- Remove the nginx default site
- $sudo rm /etc/nginx/sites-enabled/default
- Create the systemd service unit /etc/systemd/system/django-ocr-server.service
- Reload systemd
- $sudo systemctl daemon-reload
- Start the django-ocr-server service
- $sudo systemctl start django-ocr-server
- Enable the django-ocr-server service to start automatically after server is booted
- $sudo systemclt enable django-ocr-server
- Start nginx
- $sudo systemctl start nginx
- Enable nginx service to start automatically after server is booted
- $sudo systemctl enable nginx
- Go to http://{your_server}:80
- You will be redirected to admin page
Centos 7¶
- Installing nginx
- $sudo apt install nginx
- Installing uwsgi (on virtualenv django_ocr_server)
- $pip install uwsgi
- Create /var/www/ocr_server/uwsgi.ini
- Create the systemd service unit /etc/systemd/system/django-ocr-server.service
- Reload systemd service
- $sudo systemctl daemon-reload
- Chango user of /var/www/ocr_server to nginx
- $sudo chown -R nginx:nginx /var/www/ocr_server
- Start Django-ocr-server service
- $sudo systemctl start django-ocr-service
- Check that port is up
- $sudo netstat -anlpt | grep 8003
you have to got something like this:tcp 0 0 127.0.0.1:8003 0.0.0.0:* LISTEN 2825/uwsgi- Enable Django-ocr-server uwsgi service
- $sudo systemctl enable django-ocr-service
- Edit /etc/nginx/nginx.conf
- Configure selinux
- Start nginx service
- $sudo systemctl start nginx
- Enable nginx service
- $sudo systemctl enable nginx
- Configure firewall
$sudo firewall-cmd –zone=public –add-service=http –permanent$sudo firewall-cmd –reload- Go to http://{your_server}:80
- You will be redirected to admin page