New Perspectives On Web Design

(C. Jardin) #1
By Paul Tero CHAPTER 8

CheCKing The DoCuMenT RooT


Now that you’ve found the document root, you can snoop around to make
sure it’s alright. Change to the directory with cd:


$ cd /var/www/vhosts/smashingmagazine.com/httpdocs
bash: cd: /var/www/vhosts/smashingmagazine.com/httpdocs: No such file or
directory


If you get the error message “No such file or directory”, that is bad
news. Either the DocumentRoot has been incorrectly set or your whole
website has been deleted. If it is there, you can list the files with ls. The
-a also shows hidden files which start with a dot, and -l displays them in
long format with permissions and dates:


$ ls -al
drwxrwxrwx 8 nobody nogroup 4096 May 9 14:03.
drwxr-xr-x 14 root root 4096 Oct 13 2012 ..


Every folder will at least show these two entries. The single “.” is for
the current directory and “..” is for the parent directory. If that’s all there is,
then the directory is empty. While you’re there, you can double-check you
are in the correct place. Create a new file using echo and again using the >
symbol to send the output to a file.
$ echo “

My test file

” > testfile.html


This will create a file called testfile.html containing a bit of HTML. You
can use your browser or telnet or curl or wget to see if the file is where it
should be.


$ curl http://www.smashingmagazine.com/testfile.html


My test file


If that worked, then well done, you have found your website! Remove that
test file to clean up after yourself with rm testfile.html and keep going.

Free download pdf