Question

when I create my nano file and hit ^X then Yes to save file with html samples it says error

Posted March 31, 2021 148 views
ApacheUbuntu 18.04

when I create my nano file and hit ^X then Yes to save file with html samples it says error

nano /var/www/nwainternetmarketingservices.com/index.html

<html>
<head>
<title>Welcome to nwainternetmarketingservices.com!</title>
</head>
<body>
<h1>Success! The nwainternetmarketingservices.com virtual host is working!</h1>
</body>
</html>

then I hit Ctrl X the Yes to save it as: /var/www/nwainternetmarketingservices.com/index.html
[ Error writing /var/www/nwainternetmarketingservices.com/index.html: No such file or directory ]

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Hi @beauboswell,

The command states you are trying to type in a directory that doesn’t exist.

  1. Make sure it does exist like this:

    ls -lah /var/www/
    
  2. If you see a directory called nwainternetmarketingservices.com from the output good, that means there is a directory. Having said that, I’m almost certain there won’t be a directory called that way there. To fix this type in

    mkdir /var/www/nwainternetmarketingservices.com
    
  3. Once it completes, you can go ahead and do

    nano /var/www/nwainternetmarketingservices.com/index.html
    

    And paste over what you need inside.

Regards,
KFSys

  • go to www directory by executing the following command cd /var/www
  • check the owner and group of the directory nwainternetmarketingservices.com by executing the command ls -ld nwainternetmarketingservices.com
  • If it indicates that you do not own the directory, execute the command sudo chown -R $USER:USER nwainternetmarketingservices.com
  • Now after that, try creating the file again by executing
cd /var/www/nwainternetmarketingservices.com
nano index.html

If everything is fine, then the file should be able to be created