User Tools

Site Tools


it:web_site

Creating a website

All AOS users have available to them the ability to publish webpages. In order to do so, please perform the following:

  1. If it does not already exist, create the directory public_html.
    mkdir ~/public_html
  2. Ensure the permission are set correctly:
    chmod 755 ~/public_html
  3. Create your webpage called index.html in the ~/public_html directory. Here is a quick template you can use:
    <html>
       <head>
          <title>Sample AOS Webpage</title>
       </head>
       <body>
          This is my very own sample AOS webpage.
       </body>
    </html>
  4. Visit http://www.meteo.mcgill.ca/~AOS_USERNAME to view your newly created page.

Important Notes

  • Placing files in your ~/public_html directory is a good way to share things with others instead of by sending large email attachments.
  • Placing sensitive data in your ~/public_html directory is silly. Don't do it!
  • We have directory indexing turned on by default so you can create a directory under ~/public_html and put files there. When you visit http://www.meteo.mcgill.ca/~AOS_USERNAME/directory you will receive an index of that directory.

Password Protecting A Directory

Often we wish to restrict access to a certain directory and only give access to it to users under our control. Following these steps will create a directory ~/public_html/secure which is a restricted directory under our personal webspace:

  1. Create the directory ~/public_html/secure and set permissions:
    mkdir ~/public_html/secure
    chmod 755 ~/public_html/secure
  2. Create a file called ~/public_html/secure/.htaccess with the following contents:
    AuthType Basic
    AuthName "Restricted Access"
    AuthUserFile "/aos/home/AOS_USERNAME/.htpasswd" # Note: Use full path!
    require valid-user

    This file instructs the webserver that we want the ~/public_html/secure directory to be password protected with basic authentication against the file ~/.htpasswd and any user in this file can access the page.

  3. Create a username and password combination by issuing the following commands:
    htpasswd -c ~/.htpasswd userName
     New password:
     Re-type new password:
     Adding password for user userName

    This command creates the file ~/.htpasswd and adds an entry for the user userName. If we take a look at the file:

    cat ~/.htpasswd
     userName:1rp3zJGxrJ0hM

    we see that the password is encrypted.

  4. Create content in ~/public_html/secure by either copying data there or creating a webpage.
  5. See if it works by visiting http://www.meteo.mcgill.ca/~user/secure and entering the userName and password entered into the ~/.htpasswd file.

Important Notes

  • When you enter the username and password information when you visit http://www.meteo.mcgill.ca/~user/secure, they are sent over the network in clear-text. Make sure you do not use your AOS username and password!
it/web_site.txt · Last modified: 2012/05/19 12:09 by admin