r17 - 16 Oct 2006 - 18:13:51 - HiramGibbardYou are here: TWiki >  TechHelp Web > WebPageSetup

Web Page Setup

General Setup

Administering You Standard SCS page

All SCS department members are provided with a standard SCS web page.

These pages start off providing the public with your basic information like name, office number, email, etc.

You able to add aditional information like research interest, education, and updating your photo.

Normally photos are usually taken by Anne Johnson at the start of your employment at SCS.

In order to manage all of the above and more on your stabdard SCS webpage please visit http://www.scs.fsu.edu/intranet.php and login using your SCS username and password. If you are having problems logging in, please visit any of the SCS Administrative or Technical staff memebers for assistance. Any one of the listed staff members can assist you in updating your username or password (Only for SCS web logins). Once you are able to login, click on the link labeled "Manage your SCS webpage*". This page will provide you with detialed instructions on how to manage your SCS webpage.

Personal Webspace

Personal web pages are stored in your home directory. (i.e http://www.scs.fsu.edu/~_your-scs-username_)

The following page provides a quick overview of what you need to do to build a web site using your SCS web space and SCS computer account.

To publish information on the web, put the material that you wish to share in your public_html directory, which is located in your SCS home directory. Point your browser to the following address to display your files:

http://www.scs.fsu.edu/~your-username/filename

If you do not have a public_html directory in your home directory then you will need to make one and change the permissions on the directory if they are not correctly set. If you are using a machine that does not mount your home directory (link to page describing how to mount fs homedirs) then you will need to SSH to a machine that does (e.g. pamd.scs.fsu.edu).

Log in by using our SCS username and password. A successful login puts you in a shell at the base of your home directory. Type pwd and press return. You should get the full system path to your home directory (e.g., /home/some-path/your-username). If you get something different please send email to ops@scs.fsu.edu; their may be something wrong with file mounting on that machine. To make your web directory type:

  • mkdir public_html

The web server can only read files if the permissions are set correctly on the public_html directory and on your home directory. Use the chmod command to set the permissions on these directories.

  • chmod o+x ~
  • chmod o+x public_html

The first line changes permissions on your home directory the second changes permissions on the web directory called public_html. Once the permissions are set, all files stored in public_html will be visible by the web. To protect files from being viewed by anyone you can change the permissions on a particular file or directory, or you can protect files or a directory by using the htaccess method described below.

File nameing extensions

  • .html
  • .php

Restricting Content by Domain Using a .htaccess file

*Entire Directory

You will need to create a .htaccess in your restricted sub-directory. A sample .htaccess file would be:


    AuthUserFile /dev/null    
    AuthGroupFile /dev/null   
    AuthName Domain-restricted
    AuthType Basic            
                                  
    order deny,allow          
    deny from all             
    allow from .scs.fsu.edu   

This will allow any host in the .scs.fsu.edu domain to view your pages but anyone else will get a 403 Forbidden error message.

*Individual File(s)


     <FilesMatch <filename> >

     AuthUserFile /dev/null
     AuthGroupFile /dev/null
     AuthName Domain-restricted
     AuthType Basic
     order deny,allow
     deny from all
     allow from .scs.fsu.edu    

     </FilesMatch>

Custom Error pages

In order to specify your own customized error documents, you simply need to add the following command, on one line, within your htaccess file:
   ErrorDocument 400 /errors/badrequest.html
   ErrorDocument 401 /errors/authreqd.html
   ErrorDocument 403 /errors/forbid.html
   ErrorDocument 404 /errors/notfound.html
   ErrorDocument 500 /errors/serverr.html

If the relative path doesn't work, try using an absolute path like the ex. listed below.

Example:

ErrorDocument 403 http://<em>your-domain</em>/<em>your-directory-path</em>/<em>filename.ext</em>

Live Example: http://www.scs.fsu.edu/supercomputer/sp_apps_error404.php

Remember this file must be accessible by the users browser.

Password Protecting a site

Using htaccess

Make a directory where you keep protected files by typing:

  • mkdir secret-directory
  • cd secret-directory

Create a file called .htaccess (Make sure you are inside of your secret-directory)

Add the following to the .htaccess file using your favorite editor.


AuthUserFile /home/jdoe/public_html/goodstuff/.htpasswd
AuthName Personal
AuthType Basic
<Limit GET>
require valid-user
</Limit>

Note: The path assigned to AuthUserFile varies depending on what group you are in.

After logging into your home directory on pamd run the 'present working directory' (pwd) command, in order to determine your exact path.

Example for SCS postdocs:

$pwd
$/home/u2/users/username/public_html/some_directory/.htpasswd

Note: If valid-user is replaced with gibbard then gibbard will be the only user permitted to log in.

Make these changes to the above text:

  • Replace "/home/jdoe/public_html/goodstuff/" with the path that was displayed when running the pwd command.
  • Save file.

In the same directory run the following commands:

  • htpasswd -c .htpasswd someuser [it will ask for the password and then the password again]
  • Use the htpasswd command WITHOUT the -c flag to add additional users (i.e. htpasswd .htpasswd username ). Using the -c creates the .htpasswd file. Using this flag after the .htpasswd file has already been created will over write existing .htpasswd file.
  • This is very bad in the event that you already have a long list of users in this file

In the Browser:

  • Open Browser.
  • Type http://www.scs.fsu.edu/ ~username/path-to-secretdircetory
  • Password Protected dialog box should appear.

Enabling CGI capabilities

First thing is to enable CGI execution on the apache webserver

This is done in the httpd.conf file. Location varies from unix platform.
(Example: Debian stores this config file in /etc/apache/httpd.conf)

Notice the entry Options ExecCGI located in the virtual host example below.

<VirtualHost *:80>
        ServerName hirampc2.scs.fsu.edu
        DocumentRoot /sites/
                <Directory /sites/>
                        Options ExecCGI
                        AllowOverride Limit
                        Order Allow,Deny
                        Allow From All
                </Directory>
        ErrorLog /var/log/apache/sites/hirampc2.scs.fsu.edu/error.log
        CustomLog /var/log/apache/sites/hirampc2.scs.fsu.edu/access.log combined
</VirtualHost>

Next create a somefile.cgi in the path of the DocumentRoot.
(Example: /home/gibbard/public_html/somefile.cgi)

You can utilize this test code written in perl:

#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
print "Hello World!\n";

Perl will also have to be installed.

Be sure to have read and executable permissions for the world.

Navigate to the directory using a browser.
(Example: hirampc2.scs.fsu.edu/~gibbard/somefile.cgi)

If the browser displays "Hello World" then everything should be working properly.

Additional Documentation: http://www.cgi101.com/book.

Utilizing Databases at SCS

Request a database via ticketing system.

Please provide TSG with the following:

  • Name of Database wanted. (Note: The name you have choosen may already be taken.)
  • Username wanted to connect to DB.
  • What the DB is going to be used for.

Once the DB is created, we will notify you on how to obtain the DB password.

Please refer to the PhpMyAdmin Docs on how to create and manipulate tables.

File/Directory Permissions

Use the chmod command to change your file permissions on a file or a directory. The ls -al command will print detailed information for all the files and directories in your current directory.

For example, typing:

ls -al

Will give you:

-bash-2.05b$ ls -al
total 7804
drwxr-xr-x  6 gibbard  bio      512 Feb 15 22:17 .
drwxr-xr-x  4 gibbard  bio     1024 Feb  1 19:23 ..
drwxr-xr-x  2 gibbard  bio      512 Sep 20 13:56 downloads
-rw-r--r--  1 gibbard  bio        0 Feb 15 22:17 file.html
-rw-r--r--  1 gibbard  bio      951 Feb  1 21:43 index.php
drwxr-xr-x  7 gibbard  bio     2560 Jan 27 13:28 phpMyAdmin
-rw-r--r--  1 gibbard  bio  7936000 Jan 25 21:01 phpMyAdmin-2.6.1.tar
-rw-r--r--  1 gibbard  bio       22 Nov 16 13:55 phpinfo.php
drwxr-xr-x  3 gibbard  bio      512 Sep 21 05:20 projects

The output of ls -la explained

  • -bash-2.05b$ This is your shell prompt. This will differ according to the shell you are using.
  • ls -al This is the command that was run in order to retrieve the results.
  • drwxr-xr-x This sting represents the file permissions. Changing these values will determine whether other users can view, change or execute the file.
  • gibbard The file owner's username.
  • bio The file owner's principal group.
  • 512, 1024, 512, etc.. Is the size of the file in kb followed by the date and time the file was created or altered.
  • *., .., downloads, file.html, etc * Are the files or directories.

Note: Files or directories preceeded by a dot (.) are only visible when running the ls -al command not the ls command. -al Denotes "all" and "list".

File permissions explained

We'll use the downloads directory from the list output above to briefly explain file permissions.

drwxr-xr-x  2 gibbard  bio      512 Sep 20 13:56 downloads

File permissions are represented by a string of ten characters. The first character tells you what kind of file you have. Typically this is either a d for a directory or a - for a file. The remaining nine characters can be divided into three groups of three characters. The characters represent the file permissions for the user (file owner), the group, and other (everyone who can access the file system), respectively. This allows the file owner to separately enable/disable read (r), write (w), or execute (x) permissions on a file or directory for the three classes of users.

file type user group other
d rwx r-x r-x

The letters r,w,x will appear if the corresponding permissions are enabled for the corresponding class of user. Otherwise, the absence of a letter (-) means that the corresponding permission is disabled.

Following the permissions string is a number, which represents the number of files in the directory (this is always one in the case of a file). After this, you will find the file owner and the file group names, which correspond to the user and group, respectively.

How to change file permissions

Note: As long as you are the owner of the file or directory you can change the permissions.

     The command chmod is used to change the permissions of a file or directory.
     chmod 777 filename will result in rwxrwxrwx permissions.
     chmod 000 filename will result in --------- permissions (no permissions for anyone)
    
     Each number represents a set of permissions.

     Example: 7 = rwx, 7 = rwx, 7 = rwx

     Each letter contains a total value of 7
     r has a value of 4
     w has a value of 2
     x has a value of 1

     Example: chmod 644 filename
              chmod 004 filename
              chmod 430 filename

User Comments

 

Last changed: 16 Oct 2006

Show attachmentsHide attachments
Topic attachments
I Attachment Action Size Date Who Comment
htmlhtml testfile.html manage 0.5 K 16 Oct 2006 - 18:13 HiramGibbard  
Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r17 < r16 < r15 < r14 < r13 | More topic actions
 
SCS TWiki

This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback