Creating Webspace

Run the following commands from the lamp command line:

cd ~
mkdir public_html
chmod 755 public_html

If you try to access you will get a forbidden message. You still need to create your first html web page file. From the command line run:

echo "Hello World" >> ~/public_html/index.html

By default the web server will look for a file named index.html or index.php in public_html. If any of those files exist it will open and display the contents. Files that end with .php will be parsed for PHP code, please see for more details.

Put your html or php files in public_html. You will be able to access the website by visiting

5 thoughts on “Creating Webspace

  1. Anthony Hugo

    I’ve followed the instructions on this page, and installed WinSCP. I can see the html file I just created, but I still get a forbidden message when I try to go to my page.

    1. Jason Heithoff


      I see two files created under public_html directory. One is called help.html and the other is called main.html. If you tried to access each directly they would display properly in your browser. For example: help.html – and main.html –

      The reason you you see forbidden when you try and visit is because there doesn’t exist a default html file. The default html file must be called index.html or index.php. Try creating a new file in your public_html directory with the file name index.html and place some text like hello word!

  2. Jose Alava

    I’m having trouble accessing my website. I get a 404 error as if either the file didn’t exist, or the directory didn’t exist. If you check my directory you will find that I created the correct folder and I have assigned them the permission specified by my instructor. However, its still not working properly!

Comments are closed.