Hello and Thank you so much for your help
@smtalk
As a general rule,
I always check the logs in the shell.
In this case, since I wasn't even sure which log something like this would go in, I got an error telling me right away that there was no information to give me, so I activated
tail -f for all logs, with 0 results that could tell me anything.
Bash:
2025/05/25 08:36:19 [error] 288558#0: *6611 "/home/castris/domains/castris.com/private_html/blog/index.php" is not found (2: No such file or directory), client: 91.121.226.50, server: castris.com, request: "GET /blog/ HTTP/2.0", host: "castris.com", referrer: "https://castris.com/"
2025/05/25 08:37:57 [error] 288559#0: *6624 "/home/castris/domains/castris.com/private_html/blog/index.php" is not found (2: No such file or directory), client: 91.121.226.50, server: castris.com, request: "GET /blog/ HTTP/2.0", host: "castris.com", referrer: "https://castris.com/"
That's all the log says.
And the worst part is that after giving me the error, it shows me that the job was done.
I've tried absolute, relative, etc. paths. It's good that this was also well documented. At least I wasn't able to see it in the documentation.
Unknow Error
Request failed with status code 404 and provided no explanation for why it failed
Also, if I go to the
nginx configuration for the
vhost, I see its configuration, although it's not correct, which is why the problem occurs.
The user sees it as
cat /usr/local/directadmin/data/users/castris/nginx_php.conf
NGINX:
# use fastcgi for all php files
location ~ \.php$
{
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if ( $skip_cache ~ "^$" ) {
set $skip_cache 1;
}
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache FASTCGICACHE;
fastcgi_cache_valid 60m;
include /etc/nginx/nginx_limits.conf;
if (-f $request_filename)
{
fastcgi_pass unix:/usr/local/php83/sockets/castris.sock;
}
}
location ~ \.(php53|php54|php55|php56|php70|php71|php72|php73|php74|php80|php81|php82)$
{
deny all;
}
But in the original file that directadmin produces after the error, and which doesn't work,
I made some changes to
/usr/local/directadmin/data/users/castris/nginx.conf just to check that my idea was correct.
To temporarily leave it as it should be.
NGINX:
# Auto generated nginx config file by DirectAdmin version 1.677
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to their website
# For global config changes that affect all Users, see this guide:
# http://help.directadmin.com/item.php?id=558
# For local config changes that only affect one User, see this guide:
# http://help.directadmin.com/item.php?id=3
server
{
listen 5.135.93.116:80;
server_name castris.com www.castris.com;
access_log /var/log/nginx/domains/castris.com.log;
access_log /var/log/nginx/domains/castris.com.bytes bytes;
error_log /var/log/nginx/domains/castris.com.error.log;
root "/home/castris/domains/castris.com/public_html";
index index.php index.html index.htm;
# WordPress specific rules
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add security headers
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
# Deny access to hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Deny access to uploads PHP files
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
# Cache static files
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
add_header Cache-Control "public, no-transform";
}
# use fastcgi for all php files
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if ( $skip_cache ~ "^$" ) {
set $skip_cache 1;
}
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache FASTCGICACHE;
fastcgi_cache_valid 60m;
include /etc/nginx/nginx_limits.conf;
if (-f $request_filename) {
fastcgi_pass unix:/usr/local/php83/sockets/castris.sock;
}
}
location ~ \.(php53|php54|php55|php56|php70|php71|php72|php73|php74|php80|php81|php82)$
{
deny all;
}
# Mail auto configuration (Thunderbird)
location = "/.well-known/autoconfig/mail/config-v1.1.xml" {
proxy_pass http://unix:/usr/local/directadmin/shared/internal.sock;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host;
}
include /etc/nginx/webapps.conf;
}
server
{
listen 5.135.93.116:443 ssl;
http2 on;
server_name castris.com www.castris.com;
access_log /var/log/nginx/domains/castris.com.log;
access_log /var/log/nginx/domains/castris.com.bytes bytes;
error_log /var/log/nginx/domains/castris.com.error.log;
root "/home/castris/domains/castris.com/private_html";
index index.php index.html index.htm;
ssl_certificate /usr/local/directadmin/data/users/castris/domains/castris.com.cert.combined;
ssl_certificate_key /usr/local/directadmin/data/users/castris/domains/castris.com.key;
# WordPress specific rules
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add security headers
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options SAMEORIGIN;
add_header X-XSS-Protection "1; mode=block";
add_header Strict-Transport-Security "max-age=31536000" always;
# Deny access to hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# Deny access to uploads PHP files
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
# Cache static files
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d;
add_header Cache-Control "public, no-transform";
}
# use fastcgi for all php files
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if ( $skip_cache ~ "^$" ) {
set $skip_cache 1;
}
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache FASTCGICACHE;
fastcgi_cache_valid 60m;
include /etc/nginx/nginx_limits.conf;
if (-f $request_filename) {
fastcgi_pass unix:/usr/local/php83/sockets/castris.sock;
}
}
location ~ \.(php53|php54|php55|php56|php70|php71|php72|php73|php74|php80|php81|php82)$
{
deny all;
}
# Mail auto configuration (Thunderbird)
location = "/.well-known/autoconfig/mail/config-v1.1.xml" {
proxy_pass http://unix:/usr/local/directadmin/shared/internal.sock;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host;
}
# Automatic security.txt (RFC 9116)
location = "/.well-known/security.txt" {
proxy_pass http://unix:/usr/local/directadmin/shared/internal.sock;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host;
}
include /etc/nginx/webapps.ssl.conf;
}
And indeed now everything works.
Just to see it, it was worth it.
So, I still don't understand why something as simple as applying a template becomes such a headache, an error that not even the frontend system can fix, and that the backend system (logs) gives me any information about.
In that scenario, the application, aka Directadmin, leaves me out of place, since I owe it to it and its rules.
Another question about the manual, and about WordPress. I didn't write down where I found it, whether in the Directadmin documentation or somewhere else, about
fastcgi_cache_purge, a module that should be compiled in nginx if we want to work correctly with
nginx purging in WordPress. Although this may be for another separate post.
I appreciate your help, and that of the people at Directadmin
Attention! The URL doesn't resolve to DirectAdmin, but rather to my vanilla machine, where it's been for years. Due to this issue, I've left the email in DirectAdmin, but I'm keeping the site on its original system. I'm testing by tuning the IP in
/etc/hosts to access the DirectAdmin site.