I realize there are multiple similar questions already but I could not seem to find an answer that made it clear to me what I needed to do:
I have a DigitalOcean droplet which is serving a Flask application. I would now like to have a WordPress blog at /blog. I went through DigitalOcean's WordPress setup instructions but I they did not include a description of how to modify the Apache .conf
file to point to the WordPress index.php
file.
I tried adding an Alias
to my .conf
file but it does not work. When I go to /blog
right now I see the default Apache "It works!" page. However, if I go to www.rhymecraft.guru/blog/wp-admin
it does load the admin panel.
Apache .conf file
(Note that I installed WordPress into /var/www/html
.)
WSGIDaemonProcess rhymecraft.guru processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup rhymecraft.guru
<VirtualHost *:80>
ServerName www.rhymecraft.guru
ServerAlias rhymecraft.guru
ServerAdmin xxxx@gmail.com
Alias /blog /var/www/html
WSGIScriptAlias / /var/www/rhymecraft/server/rhymecraft.wsgi
DocumentRoot /var/www/rhymecraft/server
Alias /robots.txt /var/www/rhymecraft/server/robots.txt
Alias /favicon.ico /var/www/rhymecraft/server/robots.txt
<Directory /var/www/rhymecraft/server>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/rhymecraft/server/static
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.rhymecraft.guru [OR]
RewriteCond %{SERVER_NAME} =rhymecraft.guru
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
ServerName www.rhymecraft.guru
ServerAlias rhymecraft.guru
ServerAdmin xxxx@gmail.com
Alias /blog /var/www/html
WSGIScriptAlias / /var/www/rhymecraft/server/rhymecraft.wsgi
DocumentRoot /var/www/rhymecraft/server
Alias /robots.txt /var/www/rhymecraft/server/robots.txt
Alias /favicon.ico /var/www/rhymecraft/server/robots.txt
<Directory /var/www/rhymecraft/server>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/rhymecraft/server/static
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/rhymecraft.guru/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/rhymecraft.guru/privkey.pem
</VirtualHost>
Related questions and why they didn't answer my question
- How to serve Wordpress blog at /blog/
- The person asking this question is using Nginx, not Apache.
- Adding Wordpress blog to an existing website
- This person wants to host his blog on an entirely different machine.
- Setting up Wordpress and Flask on Apache2
- The person asking this question says (in his answer to his question) that he was able to get both Flask and WordPress working together, but I don't see what in his
.conf
file is enabling WordPress. The only person other than the OP to post an answer was suggesting a method that used a subdomain to host the blog rather than a subdirectory.
- The person asking this question says (in his answer to his question) that he was able to get both Flask and WordPress working together, but I don't see what in his