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:
- If it does not already exist, create the directory public_html,
mkdir ~/public_html
- Ensure the permissions on the directry are set correctly,
chmod 755 ~/public_html
- 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>
- 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:
- Create the directory
~/public_html/secure
and set permissions:
mkdir ~/public_html/secure
chmod 755 ~/public_html/secure
- 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.