Specially for Mikula :)
In this tutorial the domain name matcher.ml used for example. This is a free domain name from freenom.com. You can use another domain name, of course.
Tested with clean installation of CentOS.
-
Check CentOS version:
$ cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
-
Update system packages:
# yum update -y
-
Install dependencies:
# yum install nano httpd python36 git -y
-
Enable HTTP service:
# systemctl enable httpd.service
-
Create user 'matcher':
# adduser matcher
-
Switch to user 'matcher':
# su matcher $ cd
-
Create Python 3 virtual environment for the app:
$ python36 -mvenv venv
-
Activate virtual environment:
$ source venv/bin/activate
-
Install app from git repo branch:
$ pip install git+https://github.com/machinekoder/speed-friending-and-dating-matcher.git@master
A reason to use git repo: speed-friending-and-dating-matcher not available from PyPi.
-
Install application server:
$ pip install gunicorn
-
Create WSGI file:
$ nano wsgi.py
with content:
from speed_friending_matcher import server from speed_friending_matcher.server import app as application server.configure( input_plugin='csv:{}', output_plugin='todo:{}:{}', matchmaker='simple' )
-
Close user session:
$ exit
-
Create and open a Systemd service file for Gunicorn
# nano /etc/systemd/system/gunicorn.service
with content:
[Unit] Description=gunicorn daemon After=network.target [Service] User=matcher Group=matcher WorkingDirectory=/home/matcher ExecStart=/home/matcher/venv/bin/gunicorn --workers 2 --bind 127.0.0.1:8000 wsgi:application [Install] WantedBy=multi-user.target
-
We can now start the Gunicorn service we created and enable it so that it starts at boot:
# systemctl start gunicorn # systemctl enable gunicorn
-
Create config file for Apache:
# nano /etc/httpd/conf.d/matcher.conf
with content:
<VirtualHost *:80> DocumentRoot "/home/matcher" ServerName matcher.ml ProxyPass / http://localhost:8000/ <Directory /home/matcher/> Require all granted </Directory> </VirtualHost>
-
Restart Apache:
# systemctl restart httpd
-
Go to http://matcher.ml and enjoy!
-
Add HTTP service or port 80 with the following command:
# firewall-cmd --add-service=http --permanent
-
Once you’re done, restart firewalld with the following command:
# firewall-cmd --reload
Have a good day!