0

I've had a Flask/WSGI app running just fine on an Apache host for the last year. The httpd.conf is set up like this:

ServerName myapp.com

WSGISocketPrefix /var/run/wsgi
WSGIScriptAlias / /var/www/myapp/myapp/myapp.wsgi
WSGIDaemonProcess myapp user=user group=user threads=5
<Directory /var/www/myapp/myapp>
    WSGIProcessGroup myapp
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
</Directory>

RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^/?(.*)$ https://www.myapp.com/$1 [R=301,L]

So you go to https://myapp.com or https://myapp.com/blah and it works fine.

My client now wants to set up a Wordpress blog for the site which would live at blog.myapp.com. My Apache is weak so I'm not sure how to properly do this. Here's what I tried in httpd.conf:

WSGISocketPrefix /var/run/wsgi

NameVirtualHost *:80

<VirtualHost *:80>
   ServerName myapp.com

   WSGIScriptAlias / /var/www/myapp/myapp/myapp.wsgi
   WSGIDaemonProcess myapp user=user group=user threads=5
   <Directory /var/www/myapp/myapp>
       WSGIProcessGroup myapp
       WSGIApplicationGroup %{GLOBAL}
       Order deny,allow
       Allow from all
   </Directory>

   RewriteEngine on
   RewriteCond %{SERVER_PORT} 80
   RewriteRule ^/?(.*)$ https://www.myapp.com/$1 [R=301,L]
</VirtualHost>

<VirtualHost *:80>
   ServerName blog.myapp.com
   DocumentRoot "/var/www/html/wordpress"
</VirtualHost>

The HTTPD service restarts without a problem, but when I go to http://myapp.com I get the Apache test page. Is it possible to do what my client wants?

DeeDee
  • 333
  • 2
  • 7
  • 16

1 Answers1

0

I was able to talk my client into changing the blog's location to:

myapp.com/blog

which made the solution much easier, requiring the addition of only a single alias directive line:

ServerName myapp.com

Alias /blog /var/www/html/wordpress

WSGISocketPrefix /var/run/wsgi
WSGIScriptAlias / /var/www/myapp/myapp/myapp.wsgi
WSGIDaemonProcess myapp user=user group=user threads=5
<Directory /var/www/myapp/myapp>
    WSGIProcessGroup myapp
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
</Directory>

RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^/?(.*)$ https://www.myapp.com/$1 [R=301,L]
DeeDee
  • 333
  • 2
  • 7
  • 16