IT:Web Site

From Atmospheric and Oceanic Science
Revision as of 16:56, 24 August 2021 by Ambrish (talk | contribs)
Jump to navigation Jump to search

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 permissions on the directry are set correctly,
    chmod 755 ~/public_html
  3. Create your first webpage called index.html in the public_html directory. The following is a template you can use,
 <html>
   <head>
      <title>Sample AOS Webpage</title>
   </head>
   <body>
      This is my very own sample AOS webpage.
   </body>
 </html> 
 
  1. Visit https://web.meteo.mcgill.ca/~AOS_USERNAME to view your created page

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 https://web.meteo.mcgill.ca/~AOS_USERNAME/directory you will receive an index of that directory.

Password Protection

Restricting access to a certain directory and only giving access to it to users under our control, is possible through password protection. 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.