IT:Web Site: Difference between revisions

From Atmospheric and Oceanic Science
Jump to navigation Jump to search
(Created page with "=Creating a website= All AOS users have available to them the ability to publish webpages. In order to do so, please perform the following: # If it does not already exist, cr...")
 
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
# If it does not already exist, create the directory public_html, <br> <code> mkdir ~/public_html </code>  
# If it does not already exist, create the directory public_html, <br> <code> mkdir ~/public_html </code>  
# Ensure the permissions on the directry are set correctly, <br> <code> chmod 755 ~/public_html </code>
# Ensure the permissions on the directry are set correctly, <br> <code> chmod 755 ~/public_html </code>
# Create your first webpage called index.html in the public_html directory.  The following is a template you can use, <br>
# Create your first webpage called index.html in the public_html directory.  The following is a template you can use,
  <nowiki>
  <nowiki>
  <html>
  <html>
Line 15: Line 15:
  </html>  
  </html>  
  </nowiki>
  </nowiki>
# Visit https://web.meteo.mcgill.ca/~AOS_USERNAME to view your created page
=Notes=
* Placing files in your <code>~/public_html</code> directory is a good way to share things with others instead of by sending large email attachments.
* {{Note | Placing sensitive data in your <code>~/public_html</code> directory is silly. Don't do it. | warn}}
* We have directory indexing turned on by default so you can create a directory under <code>~/public_html</code> 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 <code> ~/public_html/secure </code> which is a restricted directory under our personal webspace:
# Create the directory <code> ~/public_html/secure </code> and set permissions: <br> <code>mkdir ~/public_html/secure </code> <br> <code>chmod 755 ~/public_html/secure </code>
# Create a file called <code> ~/public_html/secure/.htaccess </code> with the following contents:
<nowiki>
  AuthType Basic
  AuthName "Restricted Access"
  AuthUserFile "/aos/home/AOS_USERNAME/.htpasswd" # Note: Use full path!
  require valid-user
</nowiki>
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.
#

Latest revision as of 17:16, 24 August 2021

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.