Reputation: 163
I have configured apache2
and its working fine- when access http://localhost/
from the browser I am getting the correct response to the browser.
But, when i telnet to one of the client from this server and tried wget http://webserverIP
in command line, I am getting this error - wget: can't open 'index.html': File exists
From telnet, i can see, the client can successfully ping the server. Strange is in access.log, I can see response code 200 for the wget command.
The index.html
has all the permissions (chmod 777
).
Can anyone please tell me why i am getting the error?
Upvotes: 5
Views: 12286
Reputation: 39
wget
is unable to overwrite the file if it already exists in the directory it is trying to save to. Newer versions of wget
appear to work around this by adding a sequential number to the file name if it detects a file conflict (ex: 'index.html (2)').
The first time you ran wget
, index.html did not exist. wget
ran and downloaded the index.html file to the default directory. The default directory is likely the current directory you are in (reference wget -h
).
ls
command in the same directory you ran wget
, and you'll likely see an 'index.html' file in the directory.rm index.html
to delete the file.wget
again, and you should be able to download the file.Running wget -h
-P DIR Save to DIR (default .)
Upvotes: 0
Reputation: 406
It means that directory you are in already contains file index.html
.
# wget http://google.com/
Connecting to google.com (212.188.7.49:80)
Connecting to www.google.ru (64.233.161.94:80)
index.html 100% |*****************| 18381 0:00:00 ETA
# wget http://google.com/
Connecting to google.com (212.188.7.50:80)
Connecting to www.google.ru (64.233.161.94:80)
wget: can't open 'index.html': File exists
#
Upvotes: 5
Reputation: 1204
My guess is that on the client (which you have telnetted into), you do not have permission to write the file index.html. It looks like it already exists in your current directory. Please remove the file index.html in your current directory and try again. Please also make sure that you have permission to create files in the directory in which you issue the wget command.
The webserver has clearly sent the file correctly from the 200 response.
Upvotes: 4