apache/nginx_php.conf" failed (2: No such file or directory

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
15,366
Location
www.poralix.com
Hello,

Something went wrong on IP or user removal. And we got nginx's corrupted configs.

Code:
nginx: [emerg] open() "/usr/local/directadmin/data/users/apache/nginx_php.conf" failed (2: No such file or directory) in /etc/nginx/directadmin-ips.conf:211
nginx: configuration file /etc/nginx/nginx.conf test failed

We don't have user apache, and nginx+apache is installed. Why does nginx now require to include /usr/local/directadmin/data/users/apache/nginx_php.conf ?

Code:
# find /usr/local/directadmin/custombuild/custom/nginx*/* -type f
/usr/local/directadmin/custombuild/custom/nginx_reverse/conf/nginx.conf

Code:
# ./build version2.0.0 (rev: 1454)

Code:
# less /etc/nginx/directadmin-ips.conf
...
server {
        listen 11.22.33.44:443 default_server;
        server_name _;


        ssl                  on;
        ssl_certificate      /etc/httpd/conf/ssl.crt/server.crt.combined;
        ssl_certificate_key  /etc/httpd/conf/ssl.key/server.key;


        ssl_session_cache   shared:SSL:10m;
        ssl_session_timeout  5m;


        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers   on;


        root /var/www/html;
        index index.html index.htm index.php;


        include /usr/local/directadmin/data/users/apache/nginx_php.conf;


        # deny access to apache .htaccess files
        location ~ /\.ht
        {
                deny all;
        }


        include /etc/nginx/webapps.conf;
}
...

The IP was previously assigned to resellerbob

Code:
# cat /usr/local/directadmin/data/admin/ips/11.22.33.44
gateway=
netmask=255.255.255.248
ns=
reseller=resellerbob
status=shared
value=2

Code:
ls -la /usr/local/directadmin/data/users/resellerbob
ls: /usr/local/directadmin/data/users/resellerbob: No such file or directory

Reseller resellerbob was removed. IP was not cleared (not too sure why and how it happened). I see only that reseller's name was changed to apache in /etc/nginx/directadmin-ips.conf. Why apache? Why not admin? And why do we need empty /usr/local/directadmin/data/users/*/nginx_php.conf when using nginx as a reverse proxy?


Please give us any related information.
 
Hmm..
Upon Reseller deletion, DA goes through all ips in the file:
/usr/local/directadmin/data/users/resellerbob/ip.list

For any IP in that file which is not "status=server" (in the data/admin/ips/ip file), it will reset everything back to:
Code:
status=free
value=
reseller=
ns=
so.. if your 11.22.33.44 file didn't have that happen... my only guess was that the resellerbob/ip.list file was either not readable, or the 11.22.33.44 IP inside it was not there.

If the 11.22.33.44 file is untouched, check the timestamp on the file to see if it was modified at the time of the deletion.


Apache vs nginx vs apache_nginx shouldn't affect this behavior.
I'm less worried about the "apache" user in question, as that's probably just DA's fallback if the User in question doesn't exist (which shouldn't happen)

So.. I'm guessing resellerbob/ip.list is now gone, so hard to know what it had in it to debug the issue..

If it's recurring, then check the ip.list prior to deleting the Reseller to confirm what's present inside.

John
 
Hello John,

Thank you for your explanations and ideas. It was already late to check reseller's data, it was deleted before I fixed the issue on a server.

Shouldn't the line
Code:
include /usr/local/directadmin/data/users/apache/nginx_php.conf;

be changed to

Code:
|*if HAVE_NGINX_PROXY="0"|
include /usr/local/directadmin/data/users/apache/nginx_php.conf;
|*endif|
?
 
1) "apache" would only show up if the ip list file was broken, as mentioned.
I just wanted to be sure, so I found the code, so you'd likely have this somewhere in your error.log or errortaskq.log (whichever wrote the directadmin-ips.conf):
Code:
errorLog("IP:writeBaseApache: user %s does not exist and wont be added to the %s file", cf[IP_RESELLER], cf.getFilename());
I'm not too concerned with that though.


2) Anyway, as for the question, looking at the directadmin-ips.conf with the proxy setup, IP access is not proxied to apache, meaning nginx itself is handling php for direct IP access, thus the data/users/reseller/nginx_php.conf is needed for any php code that might be in:
Code:
/home/reseller/domains/sharedip/*
In theory is could be changed to be proxied, but as direct IP access isn't common, that might be why we didn't bother (can't recall exactly).

John
 
John,

Actually I did mean it in a wide meaning:

Code:
include /usr/local/directadmin/data/users/<username>/nginx_php.conf;

on the server all the files: /usr/local/directadmin/data/users/<username>/nginx_php.conf are empty. Probably there are cases when they are not empty with nginx as proxy?
 
I have exactly the same error when a reseller was deleted. There was an error in directadmin log, that the reseller-username cannot added to /usr/local/directadmin/data/admin/ip-address-here

And it leads to CSS loading error in mail.customer-domain.com/roundcube

I am also using nginx_apache. Is there any fix completedly?
 
Hello,

I am taking same issue for our many servers:

2020/01/28 07:33:02 [emerg] 16706#0: open() "/usr/local/directadmin/data/users/apache/nginx_php.conf" failed (2: No such file or directory) in /etc/nginx/directadmin-ips.conf:19

DA can fix this issue permantly please?

Thanks,
Melih
 
Hello,

I found the reason of the issue. If there is an ip added as free and not assigned, nginx is stopped sometimes. I assigned the free ip to admin and now nginx started but i am not sure if nginx will stop in future:)

I think DA should look at this case...

Thanks,
Melih
 
Was that 1.60?
Same issue here. After the update last night nginx stopped with error:
nginx: [emerg] open() "/usr/local/directadmin/data/users/apache/nginx_php.conf" failed (2: No such file or directory) in /etc/nginx/directadmin-ips.conf:17
But here is no user apache in /usr/local/directadmin/data/users/. So in directadmin-ips.conf i disabled the line to this path:
#include /usr/local/directadmin/data/users/apache/nginx_php.conf;

After that nginx starts without any problem. Rewrite the configs will regenerate this file and the problem returns.
 
1.60.1 fixes it (it was backported to 1.60 about an hour ago too, so, those latest releases not affected). It should have affected boxes only with additional free IPs and nginx.
 
Hi,
same issue here... On this night update to 1.60 the file
/etc/nginx/directadmin-ips.conf
started to be populated with nginx virtual server informations about free (unassigned) IP on the server.
Till 1.59.5 that file was empty.
Now it contain the virtual hosts nginx config of unassgned IPs with a line in each of them:

include /usr/local/directadmin/data/users/apache/nginx_php.conf

That is causing the iussue.
Bye
Marcello
 
1.60.1 fixes it (it was backported to 1.60 about an hour ago too, so, those latest releases not affected). It should have affected boxes only with additional free IPs and nginx.

I have updated directadmin to 1.60.1 and all works fine. Thanks for the quick fix! (y)
 
Also /usr/local/directadmin/custombuild/build rewrite_confs did not work, same issue here.
 
Back
Top