Monday, August 27, 2018

Apache 2.4 + mod_wsgi + Python 3.7 + Django installation on Centos 7.10

How to Apache 2.4 + mod_wsgi + Python 3.7 + Django installation


Httpd 2.4

1. Install  httpd
yum install httpd
2. Install  httpd-devel
yum install httpd-devel 

Python 3.7 on Centos 7.10

1. Download the newest python

cd /opt/
wget -dvS --no-check-certificate

2. Unpack and install

tar xzf Python-3.7.0.tgz

cd /opt/Python-3.7.0/

./configure --prefix=/usr/local --enable-shared --with-threads --enable-optimizations

make altinstall

to test if works: 
python3.7 -V


0. (optional) uninstall current mod_wsgi

yum erase mod_wsgi

1. Download the newest mod_wsgi and install

cd /opt/


tar xzf mod_wsgi-4.6.4.tar.gz

cd mod_wsgi-4.6.4.tar.gz

 ./configure --with-python=/usr/local/bin/python3.7

LD_RUN_PATH=/usr/local/lib make

make install

2. Add path to  /etc/


3. Run


4. check if mod_wsgi is linked correctly

ldd /usr/lib64/httpd/modules/ =>  (0x00007ffc465bb000) => /usr/local/lib/ (0x00007f2d23842000) => /lib64/ (0x00007f2d23626000) => /lib64/ (0x00007f2d23422000) => /lib64/ (0x00007f2d2321f000) => /lib64/ (0x00007f2d22f1d000) => /lib64/ (0x00007f2d22b50000)
        /lib64/ (0x00007f2d23fe3000)

Install Django

pip3.7 install --upgrade pip

pip3.7 install Django

Configure apache to use wsgi

Add new config at /etc/httpd/conf.d/project1.conf

<IfModule mod_ssl.c>
Listen 8443 https
<VirtualHost *:8443>

        ServerAdmin [email protected]
        DocumentRoot /var/www/html/project1

        ErrorLog /var/log/httpd/project1-error.log
        CustomLog /var/log/httpd/project1-access.log combined
        CustomLog logs/project1-ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

        # Django project
        Alias /django_1 /opt/py/django_1
        <Directory /opt/py/django_1>
                Require all granted

        Alias /static /opt/py/django_1/static
        <Directory /opt/py/django_1/static>
                Require all granted

        <Directory /opt/py/django_1>
                    Require all granted

        WSGIDaemonProcess django_1 python-path=/opt/py/django_1 python-home=/opt/py/django_1/venv
        WSGIProcessGroup django_1
        WSGIScriptAlias / /opt/py/django_1/django_1/
        WSGIPassAuthorization On

        SSLCertificateFile /etc/letsencrypt/live/
        SSLCertificateKeyFile /etc/letsencrypt/live/
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateChainFile /etc/letsencrypt/live/


Test if everything works:

Don`t forget to add ALLOWED_HOSTS in your

Also add
STATIC_URL = '/static/'
STATIC_ROOT = '/opt/py/django_1/static/'

Wednesday, August 1, 2018

Oxidized init.d script for Centos 6

Oxidized init.d script for Centos 6


To run oxidized as service

1. copy init script from oxidized/extra

 cp /usr/local/rvm/gems/ruby-2.3.0/gems/oxidized-0.24.0/extra/oxidized.init.d /etc/init.d/<br />

2. if you installed oxidized using manual (added system user oxidized) and rvm you need to modify script

cmd="sudo -u oxidized /usr/local/rvm/gems/ruby-2.3.0/wrappers/oxidized"


#export OXIDIZED_HOME=/etc/oxidized
export OXIDIZED_HOME=/home/oxidized/

3. after that start as normal service

# /etc/rc.d/init.d/oxidized start

# /etc/rc.d/init.d/oxidized status
sudo (pid  9987) is running...

# ps aux | grep oxi
oxidized  9987  1.2  0.6 861488 97496 ?        Sl   08:52   0:25 puma 3.12.0 (tcp:// [/]

#netstat -tulpn   | grep 88
tcp        0      0    *                   LISTEN      9987/puma 3.12.0 (t


Internet Storm Center Infocon Status

Internet Storm Center Infocon Status
Internet Storm Center Infocon Status