I am running a VueJS system in the root of our site driven off a Django API on the same server.
example.com is a beta testing live version.
I am wanting to load wordpress into a subfolder example.com/blog
I am running Nginx [ no Apache - and Apache is NOT installed ].
Have installed PHP and MySQL and editing our server block. See code below.
I am getting 404 errors for any files I try to access in /blog eg
https://example.com/blog/readme.html
https://example.com/blog/test.php
https://example.com/blog/index.php
https://example.com/blog/wp-admin/install.php
Here is our server block code {IP masked out}
server {
server_name example.com www.example.com 128.199.###.###;
root /var/www/html/vue/example/dist;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
alias /home/example/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;
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/example-error.log;
access_log /var/log/nginx/example-access.log;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.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.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name example.com www.example.com 128.199.###.###;
return 404; # managed by Certbot
}
Thank you kindly for any help -- I have looked through a lot of resources and tried a lot of things but no success - thank you.