I've got a "No input file specified" error in a browser when requesting a non-existing file from my site. I want my 404 error to be shown instead of it. How to fix?
Check the use-case first of all, it is valid only for the following software:
So if you have the server with the installed software as mentioned, here you can find a possible solution.
DirectAdmin developers added the patch into their repository, and the patched templates will be available with a new release of the control panel. So it is available with DA 1.56.1 or newer.
If the version is already released just make sure and upgrade the panel. If you are already updated, but still see the error, check the guide further.
You will need to connect to your server over SSH or a console as root, and copy templates to a custom folder.
Make sure your templates do not contain the fix already, run for this:
cd /usr/local/directadmin/data/templates/ grep REQUEST_FILENAME virtual_host2* -c
The templates are not patched yet if you see:
virtual_host2.conf:0 virtual_host2_secure.conf:0 virtual_host2_secure_sub.conf:0 virtual_host2_sub.conf:0
and this one:
grep REQUEST_FILENAME custom/virtual_host2* -c
One of the following outputs is expected:
custom/virtual_host2.conf:0 custom/virtual_host2_secure.conf:0 custom/virtual_host2_secure_sub.conf:0 custom/virtual_host2_sub.conf:0
or
grep: custom/virtual_host2*: No such file or directory
If outputs in your case differ from what is shown here as expected then you might need to stop following the guide.
Do not overwrite existing files, if you are asked for a confirmation.
Run:
cd /usr/local/directadmin/data/templates cp virtual_host2*.conf custom cd custom
Once you've copied the 4 VirtualHost files, open them one by one in a text editor for editing.
Find the lines:
<FilesMatch "\.(inc|php|phtml|phps|php|PHP1_RELEASE|)$"> #ProxyErrorOverride on AddHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost" .inc .php .phtml .php|PHP1_RELEASE| </FilesMatch>
The line with ProxyErrorOverride might be missing.
and change them to
<FilesMatch "\.(inc|php|phtml|phps|php|PHP1_RELEASE|)$"> <If "-f %{REQUEST_FILENAME}"> AddHandler "proxy:unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock|fcgi://localhost" .inc .php .phtml .php|PHP1_RELEASE| </If> </FilesMatch>
save and exit.
As soon as you complete the all 4 files run the following commands:
cd /usr/local/directadmin/custombuild ./build rewrite_confs
It will update configs for all existing virtual hosts in Apache.
That's it.