Webpages for SCU Engineering students are available through the Engineering Computing Center. This document describes how to set up and use webpages; see webpage-policy for policies governing the content of student webpages.
The command "webpage" will allow you to request that your webpage be created. This command is available from the Unix (Linux/OSX) command line. You may also use this utility to request that your webpages be removed from the system. Just follow the on-screen prompts to make the appropriate request.
Please note that the webpage utility submits requests to an automated system. Requests are processed every 5 minutes. It should take no longer than 15 minutes for a request to be fully processed.
Your webpage will be available at the following URLs:
- Linux Webserver - http://linux.students.engr.scu.edu/~username/ (May also be accessed via http://students.engr.scu.edu/~username/)
- SSL Webserver - https://ssl.students.engr.scu.edu/~username/ - (This site runs on the Linux server)
Both servers are configured with the same version of Apache on Linux. In general, the only difference is that one is unencrypted HTTP, while the other in encrypted HTTPS.
You can access the files that make up your webpage directly from any DC workstation.
- UNIX (Linux/OS X):
Changes made to the files in these locations will be immediately reflected on your webpage.
NOTE: The web server will not be able to access your webpages unless they are world-readable.
Changing your web content may also be done remotely using ftp or sftp.
- FTP Server:
- FTP Path:
- FTP Password: (Your Unix account password)
The same basic parameters can be used to access the system securely via sftp. This allows you to use a program like WinSCP, for example, to securely upload and manage your web content remotely.
Regular HTML files should have an extension of .html or .htm
If a URL references a directory instead of a file, the server will look for a file named index.html and use that. If index.html does not exist, the server will other index files. The full index file search list in order is:
(see below if you do not know what some of these extensions are).
If no index file is found, the server will display a listing of files in the directory.
Dynamic Content Support
The Engineering Student Webservers support several methods of producing dynamic content.
Files created with the extension .php will be processed as PHP scripts by the webservers. The servers currently support PHP5. PHP supports access to MySQL.
Further details on programming with PHP can be found here.
Note that by default, .php files are processed via mod_php, which runs as the web user, not as your individual user. This may be problematic if you want your php script to write data into your web space. If you want your php scripts to run as your individual user, you can force them to use php-cgi. To do this, See below.
By default, any file with an extension of .cgi or .pl will be treated as a CGI program if it resides in the directory /webpages/username/cgi-bin/. No other directories or extensions will be recognized as CGI programs. CGI programs will be run as your username.
If you want other files or directories to be parsed as CGI, you can do this via .htaccess files.
For example, if you wanted all .py files under the directory /webpages/username/test/cgi/ to be treated as CGI, you would:
- Create the file /webpages/username/test/cgi/.htaccess with the contents:
Options ExecCGI AddHandler cgi-script .py
NOTE: For CGI scripts to be run, execute permission must be set on the script file.
If you need to find a particular apache binary from inside a CGI script (like 'htpasswd' or 'php-cgi', for example) you can use the CGI environment variable HTTP_SERVER_DIR. This variable will be populated with the directory containing the 'httpd' binary for the server on which the script is running. You can access this variable via the normal environment variable access mechanism of your CGI's programming/scripting language.
You may want your PHP code to run with the permissions of your individual user account rather than those of the web user. This allows you to more easily and securely allow your code to write to files inside your web directory. (Though this must still be done with great care) You can enable this by telling the server to run your php via php-cgi rather than the default of mod_php.
The instructions below show you how to set all .php files under /webpages/username/php-cgi/ to run as your individual user (via php-cgi):
- Create the directory /webpages/username/cgi-bin:
$ mkdir -p /webpages/username/cgi-bin
- Create the file /webpages/username/cgi-bin/php-cgi.cgi with the contents:
#!/bin/sh exec $HTTP_SERVER_DIR/php-cgi "$@"
- Set proper permissions (world-execute) on /webpages/username/cgi-bin/php-cgi.cgi:
$ chmod a+x /webpages/username/cgi-bin/php-cgi.cgi
- Create the directory /webpages/username/php-cgi
$ mkdir /webpages/username/php-cgi
- Create the file /webpages/username/php-cgi/.htaccess with the contents
AddType application/php-cgi .php Action application/php-cgi /~username/cgi-bin/php-cgi.cgi
NOTE: Take GREAT care when allowing your code to write to files. NEVER allow files written by your web code to be shown or processed directly by the web server. Assume your code will be abused by people trying to exploit it.
If you wish to use Server-side includes (SSI) in your code, also known as server-parsed HTML, simply give your file the .shtml extension.
You can restrict access to your pages by placing directives in a file called .htaccess in your web directory. (Note the leading dot in the name)
The htpasswd program is located in /opt/apache/bin/
If you run into errors with your code, the first place you should check is the server logs. They can be found in the directory:
/opt/apache/shared/logs/ The Linux server logs are linux.students.*
An effective command for debugging is to run the following command in a terminal (or ssh session), then in your browser reload the page you're having trouble with. (This assumes you're using the Linux webserver)
gtail -f -n0 /opt/apache/shared/logs/linux.students.* | grep username
replacing username with your actual DC username. This should show you all access attempts and errors to any of your web pages.
If you are having issues with php-cgi (or other suexec-based functionality) you'll want to look at the suexec log which you can do with:
gtail -f -n0 /opt/apache/shared/logs/bespin.suexec_log | grep username
again replacing username with your actual DC username.
If you are having issues with CGI scripts, the error page you receive will contain additional logs you may want to 'tail' for further information.
My Webpage Disappeared!
If your webpage was working previously, but now the server claims it no longer exists, it's likely you've removed the required legal disclaimer on your main index page. See the webpage-policy page for more details. Once you restore the disclaimer, you can rerun the webpage command to request that your webpage be re-enabled. Once you do, your page will be restored within 15 minutes.
Any other requests or issues regarding webpages should be emailed to email@example.com.