I have installed and deployed Flask on a CentOS server but the subdomain for some reason, is not working properly. I really need some help on this one. I am actually a newbie in this field so please be a little gentle.
Here are the details:
- CentOS 7
- Python 3.6.4
- Apache/2.4.6 (CentOS)
My flask application is structured like this:
/home/user/web/mysite.net/
wsgi.py
runserver.py
mysite/
__init__.py
views.py
...
And inside views.py I have this snippet below to setup the subdomain "sub".
@app.route(rule='/', subdomain='', strict_slashes=False)
def index():
return "Index page"
@app.route(rule='/', subdomain='sub', strict_slashes=False)
def sub():
return "Subdomain working"
My conf files are setup like this:
I have a conf file called main.conf
which basically just points to the other conf files namely:
- mysite.net.httpd.conf
- mysite.net.httpd.ssl.conf
- sub.mysite.net.httpd.conf
- sub.mysite.net.httpd.ssl.conf
This is what's inside mysite.net.httpd.ssl.conf
:
<VirtualHost xx.xxx.xxx.xxx:443>
ServerName mysite.net
ServerAlias www.mysite.net
ServerAdmin admin@mysite.net
WsgiDaemonProcess mysite user=apache group=apache threads=2
WSGIScriptAlias / /home/user/web/mysite.net/wsgi.py
<Directory /home/user/web/mysite.net/mysite/>
Order allow,deny
Allow from all
</Directory>
SSLEngine on
SSLVerifyClient none
...
</VirtualHost>
,for sub.mysite.net.httpd.ssl.conf
:
<VirtualHost xx.xxx.xxx.xxx:443>
ServerName sub.mysite.net
ServerAdmin admin@mysite.net
WsgiDaemonProcess sub.mysite user=apache group=apache threads=2
WSGIScriptAlias / /home/user/web/mysite.net/mysite/wsgi.py
<Directory /home/user/web/mysite.net/mysite/mysite/>
Order allow,deny
Allow from all
</Directory>
SSLEngine on
SSLVerifyClient none
...
ErrorLog /var/log/httpd/sub_error_log
</VirtualHost>
I have also added this in the dns settings:
sub A xx.xxx.xxx.xxx
The index page is working fine but when I try to access sub.mysite.net
it just shows the same as the index page. Any h