Deploy Django app on Apache server on CentOS 7 - django

I am following this article to deploy a Django app on Apache in CentOS 7.
I have some differences compared to that article:
1 - I used port 443 for https (my machine already has port 443 open with my_app_dns)
2 - My virtual host config file /etc/httpd/conf.d/django.conf is as following:
<VirtualHost *:80>
ServerAdmin xxx#xxx.com
ServerName my_app_dns
DocumentRoot /home/centos/path_to_my_app
Alias /static /home/centos/path_to_my_app/static
<Directory /home/centos/path_to_my_app/static>
Require all granted
</Directory>
#ErrorLog /logs/apis_error.log
#CustomLog /logs/apis_access.log combined
WSGIPassAuthorization On
WSGIDaemonProcess my_app python-path=/home/centos/path_to_my_app:/home/centos/.local/share/virtualenvs/my_app-8BiokhAz/lib/python3.9/site-packages
WSGIProcessGroup my_app
WSGIScriptAlias / /home/centos/path_to_my_app/wsgi.py
<Directory /home/centos/path_to_my_app>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
3 - My app uses Postgres database instead of SQlite3.
The DocumentRoot is set to /var/www in /etc/httpd/conf/httpd.conf. I have also set up self-signed SSL certificate with the file etc/httpd/conf.d/ssl.conf). Below is some of the content of the ssl.conf file:
Listen 443 https
...
<VirtualHost _default_:443>
DocumentRoot "/var/www"
ServerName my_app_dns:443
...
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
...
</VirtualHost>
With the above setup, when I go to https://my_app_dns, I see the sample Apache Test page.
If I change <VirtualHost *:80> to <VirtualHost *:443> in the file /etc/httpd/conf.d/django.conf, going to https://my_app_dns yields this error:
my_app_dns sends an invalid response
ERR_SSL_PROTOCOL_ERROR
In folder /etc/httpd/conf.d/, I have two files : ssl.conf and django.conf. Both of these define virtual hosts. It seems only the config in ssl.conf takes effect and not the file django.conf).
I followed this article for the SSL setup.
What am I missing in this setup sequence in order to deploy the Django app content instead of the Apache Test page?
Update:
Following #Lingyan Meng's comment, I transfer the django.conf virtual host info to the ssl.conf virtual host and delete django.conf. After restarting my webpage, I see this error on the browser:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root#localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
So I checked a few log files for clues. In this log file, /var/log/httpd/ssl_error_log, I see the following error:
[Wed Oct 13 22:37:05.642226 2021] [ssl:warn] [pid 2526] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Wed Oct 13 22:37:05.697737 2021] [ssl:warn] [pid 2526] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Wed Oct 13 22:37:11.890802 2021] [mime_magic:error] [pid 2531] [client xxx.x.xxx.xx:62352] AH01512: mod_mime_magic: can't read `/home/centos/path_to_my_app/my_app/wsgi.py'
[Wed Oct 13 22:37:11.891123 2021] [mime_magic:error] [pid 2531] [client xxx.x.xxx.xx:62352] AH01512: mod_mime_magic: can't read `/home/centos/path_to_my_app/my_app/wsgi.py'
[Wed Oct 13 22:37:11.899659 2021] [:error] [pid 2527] (13)Permission denied: [remote xx.x.xx.xx:116] mod_wsgi (pid=2527, process='my_app', application='my_app_dns|'): Call to fopen() failed for '/home/centos/path_to_my_app/my_app/wsgi.py'.
[Wed Oct 13 22:37:12.185359 2021] [mime_magic:error] [pid 2532] [client xx.x.xx.xx:51889] AH01512: mod_mime_magic: can't read `/home/centos/path_to_my_app/my_app/wsgi.py', referer: https://my_app_dns/
I found a thread with a similar problem here. The suggested solution was to change the ownership of my_app folder. So I did this:
sudo chown -R apache:apache ~/path_to_myapp
Then, I verify it with:
ls -l ~/path_to_my_app
which shows:
drwxrwxr-x. 2 apache apache 89 Oct 8 21:33 my_app
-rwxrwxr-x. 1 apache apache 661 Oct 7 19:57 manage.py
drwxrwxr-x. 3 apache apache 19 Oct 8 21:59 static
So, server apache now owns the folder. But when I restart the server, I still see the same error message in ssl_error_log file.
Also, below is the full content of my /etc/httpd/conf.d/ssl.conf
Listen 443 https
SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog
SSLSessionCache shmcb:/run/httpd/sslcache(512000)
SSLSessionCacheTimeout 300
SSLRandomSeed startup file:/dev/urandom 256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin
<VirtualHost _default_:443>
DocumentRoot "/home/centos/path_to_my_app"
ServerName my_app_dns
ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
Alias /static /home/centos/path_to_my_app/static
<Directory /home/centos/path_to_my_app/static>
Options FollowSymLinks
Order allow,deny
Allow from all
Require all granted
</Directory>
WSGIPassAuthorization On
WSGIDaemonProcess my_app python-path=/home/centos/path_to_my_app:/home/centos/.local/share/virtualenvs/my_app-8BiokhAz/lib/python3.9/site-packages
WSGIProcessGroup my_app
WSGIScriptAlias / /home/centos/path_to_my_app/my_app/wsgi.py
<Directory /home/centos/path_to_my_app/my_app>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3
SSLHonorCipherOrder On
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
SSLCompression off
SSLUseStapling off
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
If someone could advise what is going on?

You may remove the django.conf, and move your settings in VirualHost in django.conf into ssl.conf and try again.

Related

Module is not imported after sys.path.append()

I am trying to deploy my django application.
Like many others I faced the problem of "missing" django, no module named django, though it exists.
I had to install Django of version 2, not the newest and it was installed into '/home/ivan/.local/lib/python3.5/site-packages/'.
I have my apache configured and wsgi.py looks like this:
"""
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
import sys
sys.path.append('/home/ivan/.local/lib/python3.5/site-packages/')
print(sys.path)
# import /home/ivan/.local/lib/python3.5/site-packages/django
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_wsgi_application()
When I type python3 in terminal and do this:
>>> import django
>>> django.__path__
['/home/ivan/.local/lib/python3.5/site-packages/django']
So I got my path of django module and I append it, I also tried:
sys.path.insert(0, '/home/ivan/.local/lib/python3.5/site-packages/django')
and still I got 500 error with annoying:
[Tue Apr 21 13:12:41.861348 2020] [wsgi:error] [pid 29470] [remote 185.201.90.67:1131] Traceback (most recent call last):
[Tue Apr 21 13:12:41.861379 2020] [wsgi:error] [pid 29470] [remote 185.201.90.67:1131] File "/var/www/mysite/mysite/wsgi.py", line 15, in <module>
[Tue Apr 21 13:12:41.861384 2020] [wsgi:error] [pid 29470] [remote 185.201.90.67:1131] from django.core.wsgi import get_wsgi_application
[Tue Apr 21 13:12:41.861397 2020] [wsgi:error] [pid 29470] [remote 185.201.90.67:1131] ImportError: No module named 'django'
Why wsgi cannot work properly? What am I doing wrong here?
Why interpreter cannot find a module after I forced him by sys.path.insert() ?
Huge thank in advance!
UPDATE ONE
print(sys.path) inside of wsgi returns:
['/var/www/mysite', '/usr/lib/python35.zip', '/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3/dist-packages',
'/home/ivan/.local/lib/python3.5/site-packages/']
UPDATE TWO
Since I am trying to deploy the app, no matter how I solve it.
Thanks to #KolaB for advice of virtualenv.
I just did it , now I have this structure:
├── mysite
├── requirements.txt
└── venvdjang
venvdjang is a dir with virtual interpreter.
I also installed django by source /venvdjang/bin/activate
pip install -r requirements.txt
Now, how can I tell my wsgi and apache2 that I want to use virtualenv?
Update Three
Thank you all for your help!
I have a VPS with flask application in production (www.example.com)
Now I have to deploy another one web application on subdomain - django. (www.sub.example.com)
This is config for django.
/etc/apache2/sites-available/mysite.conf
<VirtualHost *:80>
ServerName sub.example.com
ServerAlias www.sub.example.com
ServerAdmin sub.example.com#gmail.com
#DocumentRoot /var/www/mysite
ErrorLog ${APACHE_LOG_DIR}/mysite-error.log
CustomLog ${APACHE_LOG_DIR}/mysite-access.log combined
#DocumentRoot /var/www/mysite/index.html
WSGIDaemonProcess mysite processes=2 threads=25 python-path=/var/www/mysite
WSGIProcessGroup mysite
WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py
Alias /robots.txt /var/www/mysite/static/robots.txt
Alias /favicon.ico /var/www/mysite/static/favicon.ico
Alias /static/ /var/www/mysite/static/
Alias /static/ /var/www/mysite/media/
<Directory /var/www/mysite/mysite>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Directory /var/www/mysite/static>
Require all granted
</Directory>
<Directory /var/www/mysite/media>
Require all granted
</Directory>
</VirtualHost>
and this is config for flask
/etc/apache2/sites-available/FlaskApp-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName www.example.com
ServerAdmin example.com#mywebsite.com
WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
<Directory /var/www/FlaskApp/FlaskApp/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/FlaskApp/FlaskApp/static
<Directory /var/www/FlaskApp/FlaskApp/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
ServerAlias example.com
SSLCertificateFile /etc/letsencrypt/live/example.com
--p1ai/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com--p1ai/privkey.pem
</VirtualHost>
</IfModule>
<IfModule mod_ssl.c>
<VirtualHost *:80>
ServerName example.com
Redirect / https://www.example.com
ServerAdmin admin#mywebsite.com
WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
<Directory /var/www/FlaskApp/FlaskApp/>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/FlaskApp/FlaskApp/static
<Directory /var/www/FlaskApp/FlaskApp/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
# RewriteCond %{SERVER_NAME} = example.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
#RewriteCond %{SERVER_PORT} !^443$
#RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
</VirtualHost>
</IfModule>
OS - Ubuntu 16.04
mod_wsgi was installed a few years ago by sudo apt-get install
Update Four
I changed WSGIDaemonProcess python-home as #Alasdair said to python-home=/var/www/venvdjang but it did not work out.
Now if I run in terminal source /var/www/venvdjang/bin/activate
(venvdjang) ivan#server:/var/www$ python
Python 3.5.2 (default, Oct 8 2019, 13:06:37)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> import sys
>>> sys.path
['', '/var/www/venvdjang/lib/python35.zip', '/var/www/venvdjang/lib/python3.5',
'/var/www/venvdjang/lib/python3.5/plat-x86_64-linux-gnu',
'/var/www/venvdjang/lib/python3.5/lib-dynload',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/var/www/venvdjang/lib/python3.5/site-packages']
>>>
But my wsgi.py after removing all sys.path.append() staff still returns after print(sys.path) this:
['/var/www/venvdjang',
'/usr/lib/python35.zip',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/usr/lib/python3.5/lib-dynload',
'/usr/local/lib/python3.5/dist-packages',
'/usr/lib/python3/dist-packages']
It is like he still goes to system interpreter...
Why I cannot refer to a correct virtualenv ?

Error 403: Forbidden You don't have permission to access / on this server with apache, mod-wsgi and django

I am new in django and apache. I want to publish my django website by apache and mod-wsgi.
when I start httpd.exe, I recieve 403 forbidden error in my browser.
my apache config is here
LoadFile "c:/users/zharf/appdata/local/continuum/anaconda3/envs/django/python36.dll"
LoadModule wsgi_module "c:/users/zharf/appdata/local/continuum/anaconda3/envs/django/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIPythonHome "c:/users/zharf/appdata/local/continuum/anaconda3/envs/django"
Alias /static/ /D:/user/JarfaSys/static/
<Directory D:/user/JarfaSys/static/>
AllowOverride none
Require all granted
</Directory>
WSGIScriptAlias / /D:/user/JarfaSys/JarfaSys/wsgi.py
WSGIPythonPath /D:/user/JarfaSys/
WSGIPassAuthorization On
<VirtualHost 127.0.0.1:443>
DocumentRoot D:/user/JarfaSys
Alias /favicon.ico D:/user/JarfaSys/JarfaSys/favicon.ico
Alias / /D:/user/JarfaSys/JarfaSys/wsgi.py
ServerName 127.0.0.1
SSLEngine on
SSLCertificateKeyFile C:/Users/zharf/TibiFiles/host.key
SSLCertificateFile C:/Users/zharf/TibiFiles/host.cert
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
<Directory D:/user/JarfaSys/JarfaSys/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
WSGIScriptAlias / /D:/user/JarfaSys/JarfaSys/wsgi.py
WSGIPythonPath /D:/user/JarfaSys/
WSGIPassAuthorization On
<Directory D:/user/JarfaSys/JarfaSys/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
wsgi.py is :
import os
import sys
path = "D:/Ghanbari/JarfaSys/JarfaSys"
if path not in sys.path:
sys.path.append(path)
os.environ['PYTHON_EGG_CACHE'] = '/tmp/.python-eggs'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "JarfaSys.settings")
#print os.getenv("DJANGO_SETTINGS_MODULE")
#print os.getenv("PYTHON_EGG_CACHE")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
error log file is here
[Fri Aug 23 16:29:26.827875 2019] [core:error] [pid 10784:tid 1092] (20024)The given path is misformatted or contained invalid characters: [client ::1:50025] AH00036: access to / failed (filesystem path 'C:/D:')
[Fri Aug 23 16:29:26.848875 2019] [core:error] [pid 10784:tid 1092] (20024)The given path is misformatted or contained invalid characters: [client ::1:50025] AH00036: access to /favicon.ico failed (filesystem path 'C:/D:'), referer: http://localhost/
Apache service user has access to my app directory.
I study many similar questions but the problem is not solved. any suggestions would be appreciated.
Here is an example of project setup in apache. You vhosts file has a few errors
Listen 443
<VirtualHost *:443>
ServerName localhost
ErrorLog "logs/logname-error.log"
CustomLog "logs/logname-access.log" common
WSGIScriptAlias / "C:\workspace\your_project_path\wsgi.py"
Alias /static/ C:/workspace/static/
<Directory C:\your_project_path>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>
Remove the / Before the D:/... use the above as pattern.
and an example of a wsgi.py
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
activate_env = r"C:\your_virtual_environment_path\Scripts\activate_this.py"
with open(activate_env) as f:
exec(f.read(), {"__file__": activate_env})
from your_main import app as application

Django & WSGI - permission denied

I have a config like this :
CentOS 7 - Varnish ( cache server ) / Nginx ( reverse proxy ) / Apache
And it's my Django configuration :
WSGISocketPrefix /var/run/wsgi
<VirtualHost ip:8181>
ServerName domain.ir
ServerAlias www.domain.ir
ServerAdmin info#domain.ir
DocumentRoot /var/www/DjangoProject
UseCanonicalName On
ScriptAlias /cgi-bin/ /var/www/DjangoProject/cgi-bin/
<Directory /var/www/DjangoProject/DjangoProject>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /statics/ "/var/www/DjangoProject/statics/"
<Directory "/var/www/DjangoProject/statics">
Require all granted
</Directory>
WSGIDaemonProcess DjangoProject python-path=/usr/lib/python3.4/site-packages python-home=/var/www/DjangoProject user=djangouser socket-user=djangouser
WSGIProcessGroup DjangoProject
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias / /var/www/DjangoProject/DjangoProject/wsgi.py
ErrorLog /var/log/apache/django-error.log
</VirtualHost>
When i want to open my website there is a permission denied error in apache log :
[wsgi:error] [pid 2131:tid 140344565954304] (13)Permission denied: [client 77.104.92.126:38982] mod_wsgi (pid=2131): Unable to connect to WSGI daemon process 'TiTar_API' on '/var/run/wsgi.2128.0.1.sock' as user with uid=99.
I know that uid=99 is nobody user. What's going on here? Why this user want to connect WSGI socket? What is the purpose of user and socket-user attributes in WSGIDaemonProcess?
Edit : I saw other questions too, but i think there is another problem ( nobody user )
Django-WSGI setup causing permission denied issues on CentOS 7
Django + Apache + mod_wsgi permission denied
https://serverfault.com/questions/357804/apache2-mod-wsgi-django-named-virtual-servers

Django - Truncated or oversized response headers received from daemon process

I'm using django (2.0.1) on Raspberry Pi 3 with DietPi on it. I've upgraded RPI today and got this error
[Fri Mar 02 08:29:57.741991 2018] [wsgi:error] [pid 1564:tid 1861219376] [client 127.0.0.1:60308] Truncated or oversized response headers received from daemon process 'app': /home/user/app/app/wsgi.py, referer: http://app/
It worked well.
My config for apache
<VirtualHost *:80>
TimeOut 120
ServerAdmin admin
ServerName app
ServerAlias app
ErrorLog /home/user/app/logs/error_log
CustomLog /home/user/app/logs/access_log common
WSGIScriptAlias / /home/user/app/app/wsgi.py
WSGIDaemonProcess appprocesses=6 python-path=/home/user/app:/home/user/app_env/lib/python3.5/site-packages header-buffer-size=65536 inactivity-timeout=300
WSGIProcessGroup app
<Directory "/home/user/app">
Require all granted
</Directory>
Alias /robots.txt /home/user/app/static/robots.txt
Alias "/static/admin/" "/home/user/app/root/admin/"
<Location "/home/user/app/root/admin">
SetHandler None
</Location>
Alias "/media/" "/home/user/app/media/"
<Location "/home/user/app/media/">
SetHandler None
</Location>
Alias "/static/" "/home/user/app/static/"
<Location "/home/user/app/static/">
SetHandler None
</Location>
<LocationMatch "\.(jpg|gif|png|js|css)$">
SetHandler None
</LocationMatch>
<Directory "/home/user/app" >
WSGIProcessGroup terminal
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
my /home/user/app/app/wsgi.py is standard from django.
RPI connects trough USB0 to rfid-reader and because of this error I get a 500-error-page.
I don't know where am I wrong. I hope you can help.

How to configure apache 2.4 VirtualHost with wordpress and django wsgi on debian?

I want to add a wordpress app at blog.mydomain.com but I already have a Django app at mydomain.com running with wsgi in deamon mode.
I work on a Linux server (debian) with apache2.4.10 and PHP 5.6
Here is my apache conf for mydomain.com (django.conf):
<VirtualHost 000.000.000.000:443> (my server ip)
ServerName mydomain.com
ServerAlias mydomain.com
ServerAlias www.mydomain.com
SSLEngine On
SSLCertificateFile /pathToSsl/ssl.crt
SSLCertificateKeyFile /pathToSsl/ssl.key
SSLCertificateChainFile /pathToSsl/ssl.pem
SSLVerifyClient None
WSGIDaemonProcess mydomain.com threads=4
WSGIProcessGroup mydomain.com
WSGIScriptAlias /path/to/settings/wsgi.py
# Aliases toward static data
Alias /media /pathToMedia/media/
Alias /static /pathToStatic/static/
Alias /log /var/www/html/
<Directory /path/to/settings>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access-mydomain.com.log combined
ErrorLog ${APACHE_LOG_DIR}/error-mydomain.com.log
ErrorDocument 500 "Oups something goes wrong."
</VirtualHost>
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias mydomain.com
ServerAlias www.mydomain.com
Redirect / https:// mydomain.com/
</VirtualHost>
This one is working perfectly.
And now I add a new configuration for my wordpress blog (wordpress.conf):
<VirtualHost *:80>
ServerName blog.mydomain.com
DocumentRoot "/var/www/html/wordpress"
<Directory /var/www/html/wordpress>
AllowOverride all
Options Indexes FollowSymLinks
Require all granted
</Directory>
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access-blog.fr.log combined
ErrorLog ${APACHE_LOG_DIR}/error-blog.fr.log
</VirtualHost>
The problem is when i try to access to blog.mydomain.com, I am redirected to mydomain.com after few seconds.
At the beginning, I thought that was because my conf wordpress was not found but if I put
Redirect / stackoverflow.com
in wordpress.conf and it's working. So the issue is not here.
I find this in my apache error log for the wordpress blog :
[Mon Oct 24 13:15:55.829675 2016] [wsgi:error] [pid 16958] [client 000.000.000.000:38439] mod_wsgi (pid=16958): Exception occurred processing WSGI script '/path/to/settings/wsgi.py'., referer: http://blog.mydomain.com/
[Mon Oct 24 13:15:55.829844 2016] [wsgi:error] [pid 16958] [client 000.000.000.000:38439] IOError: failed to write data, referer: http://blog.mydomain.com/
In my opinion, the problem come from wsgi, but i don't know why and how to resolve it.
I don't understand why this conf go over wsgi.
I hope you can help me.
Thanks for reading.