The site runs Vue.JS as the root APP with a Django API

I’m wanting to run wordpress at mydomain.com/blog – as a sub folder

I have followed the DigitalOcean install document for PHP and MySQL (Nginx was already installed). Apache is not used and not installed

The site will server txt or HTML files eg https://mydomain.com/blog/readme.html but if I try to access
https://mydomain.com/blog/test.php or https://mydomain.com/blog/index.php it just downloads and does not execute the php.

I have checked the nginx server blocks and tested php is loaded - and reloaded everything - rebooted server etc – but still no luck.

Here is my server block

server {
    server_name mydomain.com www.mydomain.com 123.456.789.123;

    root /var/www/html/vue/mydomain/dist;

    location = /favicon.ico { access_log off; log_not_found off; }

    location /static/ {
        alias /home/mydomain/src;
    }

    location / {
        try_files $uri $uri/ /index.html /index.php;
    }

    location ^~ /rest-auth/ {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;
    }

    location ^~ /api/ {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;
    }

    location ~ /\.ht {
        deny all;
    }

   location ^~ /admin {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;
    }

    location ^~ /blog {
      alias /var/www/html/blog;
      index index.php index.html index.htm;
      try_files $uri =404;
    }

# For security reasons, set php settings at root level.
# This prevents root level php files from showing as plain text.
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    error_log  /var/log/nginx/mydomain-error.log;
    access_log /var/log/nginx/mydomain-access.log;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
    if ($host = www.mydomain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = mydomain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name mydomain.com www.mydomain.com 123.456.789.123;
    return 404; # managed by Certbot
}

Thanks for any help it would be so appreciated – taken 6 hours so far and tried so many things and read lots of articles but nothing works – thank you.

edited by MattIPv4
1 comment
  • Show comment This comment has been marked as resolved by affyboy.
    edited by MattIPv4
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!