Install WordPress in a sub folder of a Django App

Hello,
I will like to know if there is a guide or if anyone has experience with installing a WordPress website on a subfolder.

the main domain is running a Django app, but now I want to setup www.domain.com/blog which will be a WordPress blog.

Any tips?

Server is Ubuntu 20.04 with Nginx.

7 Replies

Hey there!

While I have not created a project like this myself, I did a little research to see possible ways to implement this. To start off, we have a comprehensive guide to Installing Wordpress on Ubuntu 18.04 that you can look over. There may be some minor differences between Ubuntu 20.04 and Ubuntu 18.04 that you'll have to account for. As this guide is written for users that are creating a WordPress installation at the root of their website, you will have to make some modifications to the guide. Specifically, you will have to add an Nginx location directive to your /etc/nginx/sites-available/example.com configuration file. This will allow you to map the www.domain.com/blog URL to your actual WordPress files. An example of how to do this is in this article Configuring Wordpress alongside Django as a subdirectory.

To assist getting this question more attention, I've added some subject-specific tags that will allow our experienced Community Members to find your post more easily. I'd encourage anyone who's successfully deployed a website like this to weigh in.

@clucas,
Thanks for your response.
I will take a look at all the recommended links above.
I hope I find one that works for me.

@clucas
So, I have installed LEMP stack and downloaded wordpress but it is still not working.

I have this setting in my nginx configuration.

location /blog {
    root /var/www/html/myblog/public_html;
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass   unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_index    index.php;
    include    fastcgi_params;
}

when I go to mydomain.com/blog it loads my django default 404 error page instead of picking the wordpress that I want to setup in that url path.

Any ideas?

Any help? @stevewi @andysh

@Josylad --

You can install WP wherever you have permission to do so. WP doesn't care. In apache2 parlance (sorry I don't use nginx), you have to make sure that the DocumentRoot for the VirtualHost "containing" WP is configured to the directory where you installed WP.

I can't offer you much more help than that…as I said, I don't use nginx. Maybe @andysh can offer more insight…

There are no "folders" in Unix/Linux…there are only directories.

-- sw

Hi @Josylad

Can you post your whole “server” block that contains your Django and WordPress configs?

Hi @andysh
I have been able to fix it that day and it works perfectly.

I was already on the right part, I was just mixing some things up.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct