Reputation: 12242
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.
(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 [email protected]
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 [email protected]
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>
.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.Upvotes: 2
Views: 473
Reputation: 12242
I got it working.
Two things I needed to do:
Alias /blog /var/www/html
in both VirtualHost entries. At first I had only put it in the port 80 (normal-HTTP-traffic) entry, but forgot to put it in the port 443 (HTTPS traffic) entry.
index.html
file that was in the /var/www/html
directory.
index.php
file that WordPress had added to the directory.Upvotes: 1