Flask and WordPress on the same domain in nginx

I need to add WordPress blog to my Flask site.
I tried to deploy blog to working nginx config in this way:

server {
listen 80;
server_name localhost;

location / {
    uwsgi_pass unix:/tmp/site.sock;
    include uwsgi_params;
}

location = /blog/ {
   alias /var/www/blog/;
   index index.php;
   try_files $uri $uri/ /blog/index.php?q=$uri?$args;
}


location ~ /blog/.+.php$ {
   root /var/www/;
   include /etc/nginx/fastcgi_params;
   fastcgi_pass 127.0.0.1:9000;
}

# path for static files
location  /static/ {
    alias /var/www/site/static/;
    autoindex on;
    expires max;
}
}

But wordpress shows me only 404 page(not standart, this page was made expessially for blog and included to wordpress page)
Otherwise, I checked, that connection to database created and wp_config works.
May be I missed some setting in WP or nginx config?

Related posts

Leave a Reply

1 comment

  1. You really didn’t explain what locations server what exactly, but if the problem is about alias with try_files like @Seberius mentioned, then try
    try changing

    alias /var/www/blog/;
    

    to

    root /var/www/;
    

    Then reload nginx