Web Space

From PHASTA Wiki
Jump to: navigation, search

Users with accounts on jumpgate-phasta.colorado.edu automatically have some web space; effectively your own personal website/webpage. The files for that webpage are controlled through a directory in your home directory on portal1.

How to Create

To use it you should make a directory called public_html in your home directory on portal1, and set it so that it can be read by other users

 mkdir ~/public_html
 chmod a+rx ~/public_html

Then you can add a simple HTML file to the directory, give it the correct permissions, and it will be publicly viewable:

 echo '<html><head></head><body>Hello World</body></html>' >> ~/public_html/index.html
 chmod a+r ~/public_html/index.html

Any files you put in your public_html directory will be available from http://fluid.colorado.edu/~your_username

Restricting Access

The web server will obey certain apache configuration directives put in files called .htaccess/ with appropriate permissions.

For example, to have the server require a password to view the contents of a directory over the web, you might put this in your .htaccess/ (note that .htaccess/ files apply to the directories containing them):

 AuthUserFile /users/your_user/public_html/.htpasswd
 AuthName "Enter the password"
 AuthType Basic
 require valid-user

You'll also need to create the .htpasswd/ file that you specified above using the htpasswd tool:

 htpasswd -c /users/your_user/public_html/.htpasswd username_to_add

If you want to restrict filesystem access for local users as well, you can do this in the normal way, however any content you want to be available on the web must be readable by uid/gid 33

Restricting Access to People with Accounts

Put the following in a file called .htaccess in the directory you want to restrict (and set the permissions as above):

 AuthBasicProvider ldap
 AuthType basic
 AuthzLDAPAuthoritative off
 AuthName "Authenticate!"
 AuthLDAPURL "ldap://ldap.phasta.colorado.edu:389/dc=phasta,dc=colorado,dc=edu"
 require valid-user

HTML Basics

HTML is a markup language. This means that you insert extra information ("tags") which tell the interpreter (web browser) information about the content that you're providing so that it can be displayed properly. The absolute minimal html file should have the following:

 <html>
 <body>
  Your Content Here
 </body>
 </html>

Each tag should always be closed. For example, if you wanted to link to a website, you could use the "a" tag:

 <a href="http://www.google.com"> Google! </a>

The link tag here is opened, a parameter is specified, some text is provided ("Google!") and it is then closed with the corresponding closing tag "</a>"

Some other useful HTML tags are:

- start a paragraph
- break

HTML Resources

http://w3schools.com/ http://www.webmonkey.com/

Limitations

Currently server side scripting is now allowed