Websites

How do I set up a personal World Wide Web (WWW) home page?

First, you must create a public_html subdirectory in your home folder with permissions of 711:

cd
mkdir public_html
chmod 711 ./public_html

Now anything placed under this directory will be accessible from the web using the ~ operator. For example,

http://www.cs.colostate.edu/~USERNAME/file

Would map to ~/public_html/file. If you are running into Access Forbidden errors, you probably have a permissions problem.

In general, the permissions for web should be:

644 for regular files (HTML, CSS, images, etc)
600 for PHP files
711 for directories

Note that PHP scripts do not need to be world-readable and are run using the permissions of their owner. This prevents other CS users from being able to see your PHP code.

Our web server also looks for files named index.html, index.php, etc. to determine the default page to be displayed when accessing a directory from the web. If you have an index.html in your ~/public_html/ directory, it will be displayed when visiting http://www.cs.colostate.edu/~USERNAME


How do I configure CGI scripts to work with my home page?

All cgi scripts in user home directories are run using the suEXEC wrapper. This causes cgi scripts to run with the owner’s permissions. The scripts must also reside under the following path to be recognized as cgi scripts

~/public_html/cgi-bin

and are referenced as

http://www.cs.colostate.edu/~username/cgi-bin/scriptname

CGI scripts do NOT need to have permission bits set in the group or other fields.

For further information, see the suEXEC documentation.


How do I use PHP on my home page?

All php scripts in user home directories are run using the suPHP wrapper. This causes php scripts to run with the owner’s permissions.

PHP scripts do NOT need to have permission bits set in the group or other fields.

suPHP requires that all php sessions be given a name that is unique to your page. A quick and easy to ensure that that your session names do not conflict is to base the session name on the directory that the script resides in

session_name(substr(str_replace("/", "_", getcwd()), 1, 512));

For further information, see the suPHP documentation.


How do I password-protect some of my web pages?

For information on how to set up password protection for your web-pages, log onto a department Linux machine and consult the text-file, ~info/htpasswd