Difference between revisions of "Web Space"
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Users with accounts on jumpgate-phasta.colorado.edu automatically have some web space. To use it you should make a directory called | + | 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 [[PHASTA_Group_Machines#portal1 |portal1]]. |
+ | |||
+ | == How to Create == | ||
+ | To use it you should make a directory called <code>public_html</code> in your home directory on <code>portal1</code>, and set it so that it can be read by other users | ||
mkdir ~/public_html | mkdir ~/public_html | ||
chmod a+rx ~/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 | echo '<html><head></head><body>Hello World</body></html>' >> ~/public_html/index.html | ||
chmod a+r ~/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 | + | Any files you put in your <code>public_html</code> directory will be available from http://fluid.colorado.edu/~your_username |
== Restricting Access == | == Restricting Access == | ||
− | The web server will obey certain apache configuration directives put in files called | + | The web server will obey certain apache configuration directives put in files called <code>.htaccess/</code> 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): | + | 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 <code>.htaccess/</code> (note that <code>.htaccess/</code> files apply to the directories containing them): |
AuthUserFile /users/your_user/public_html/.htpasswd | AuthUserFile /users/your_user/public_html/.htpasswd | ||
Line 19: | Line 25: | ||
require valid-user | require valid-user | ||
− | You'll also need to create the .htpasswd file that you specified above using the | + | You'll also need to create the <code>.htpasswd/</code> file that you specified above using the <code>htpasswd</code> tool: |
htpasswd -c /users/your_user/public_html/.htpasswd username_to_add | 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 | + | 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 == | == Restricting Access to People with Accounts == | ||
− | Put the following in a file called | + | Put the following in a file called <code>.htaccess</code> in the directory you want to restrict (and set the permissions as above): |
AuthBasicProvider ldap | AuthBasicProvider ldap |
Latest revision as of 09:43, 28 October 2020
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.
Contents
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/