I have static html files at /var/www/public they are pointed at / Location / nd it is working perfectly.
but on location /blog i was planning to run bludit blog
The url /blog/ gives me the index.php but on anyother url like /blog/create-your-own-content i am getting 404
Please help.
Here is the complete configuration
##
# This is the main Nginx configuration file.
# It should typically be located at /etc/nginx/nginx.conf
# This file includes configuration snippets from other files.
# Those files are located in /etc/nginx/conf.d/.
##
# Default server configuration
server {
# SSL configuration
listen [::]:443 ssl ipv6only=on; # Listen for IPv6 connections on port 443
listen 443 ssl; # Listen for IPv4 connections on port 443
server_name insurancepadosi.in www.insurancepadosi.in; # Your domain names
# SSL certificate configuration
ssl_certificate /etc/letsencrypt/live/insurancepadosi.in/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/insurancepadosi.in/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf; # SSL configuration options
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # Diffie-Hellman parameter for SSL
# Root directory for the main website
root /var/www/html/public;
# Default index files
index index.html index.htm index.nginx-debian.html;
# Main location block for handling requests to the root
location / {
# Try serving the requested file or directory,
# fallback to displaying a 404 error if not found
try_files $uri $uri.html $uri/ =404;
}
# Location block for serving the blog at /blog
location /blog/ {
alias /var/www/html/bludit;
index index.php;
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
}
location ~ ^/bl-content/(databases|workspaces|pages|tmp)/.*$ { }
location ^~ /blog/bl-content/databases/ {
deny all;
}
location ^~ /blog/bl-content/workspaces/ {
deny all;
}
location ^~ /blog/bl-content/pages/ {
deny all;
}
location ^~ /blog/bl-kernel/*.php {
deny all;
}
# Additional security configuration to deny access to .htaccess files
location ~ /\.ht {
deny all;
}
}
# Server block for handling HTTP traffic and redirecting to HTTPS
server {
listen 80 default_server; # Listen for HTTP connections on port 80
listen [::]:80 default_server; # Listen for HTTP IPv6 connections on port 80
server_name insurancepadosi.in www.insurancepadosi.in; # Your domain names
# Redirect all HTTP traffic to HTTPS
return 301 https://$host$request_uri;
}