Editing the group website: Difference between revisions

From Powers Wiki
Line 15: Line 15:


==Uploading files to the server==
==Uploading files to the server==
Pushing files to [http://bionmr.unl.edu bionmr] is done using the '''scp''' program, a remote file copy program similar to '''rsh''', but secured through [[:Wikipedia:Secure_Shell|SSH]]. To send a file to the server, use the following command (from a linux workstation):
Pushing files to [http://bionmr.unl.edu bionmr] is done using the '''scp''' program, a remote file copy program similar to '''rcp''', but secured through [[:Wikipedia:Secure_Shell|SSH]]. To send a file to the server, use the following command (from a linux workstation):


  scp /path/to/local/file bionmr.unl.edu:/tmp
  scp /path/to/local/file bionmr.unl.edu:/tmp

Revision as of 04:23, 4 August 2012

The group website is located on bionmr, in a typical LAMP configuration. The server has no NFS or Samba access, so the only way of editing pages is with vi via an ssh login. Also, as it has no FTP access, the only means of uploading files is scp. Fear not! These methods are more secure, and are just as simple as those you already use. This page details how to edit the group website.

ACHTUNG

Please edit files on the website with extreme caution and respect! Make sure you don't overwrite or delete files unless you're absolutely certain it's OK to do so.

General website access

You can log into the server and send files to the server with the ssh and scp commands, respectively. The following subsections detail how to do so.

Logging into the server

Logging into bionmr is identical to logging into bionmr-c1. You'll need the same RSA key, username and password. If you're on linux, you're already set up:

ssh bionmr.unl.edu

On windows, you'll need to copy the PuTTY session to a new name, and edit the hostname to bionmr instead of bionmr-c1.

Uploading files to the server

Pushing files to bionmr is done using the scp program, a remote file copy program similar to rcp, but secured through SSH. To send a file to the server, use the following command (from a linux workstation):

scp /path/to/local/file bionmr.unl.edu:/tmp

Once you've logged into the server, the file(s) will be located in /tmp.

Editing the website

Directory structure

The website data is located in /var/www/localhost/htdocs. Documents available on the top-level of the server are found here (e.g. http://bionmr.unl.edu/nmr.php will be nmr.php). Please notice that all the files are owned by the apache user with rwxr--r-- (644) permissions. To copy a file into this directory, use the following command:

sudo install -v -m 644 -o apache -g apache /path/to/file /var/www/localhost/htdocs/new-filename

Again, because files are owned by apache, you have to use sudo vi to edit them. A few special subdirectories exist here that you need to know about.

courses

The courses directory contains files for courses, rather unsurprisingly. Each subdirectory of courses, such as courses/chem116 has a file called content.php and directories organizing course content into groups like exams, lectures and information. The directory names there are not set in stone; you just have to edit the content.php file to link to them, as detailed below.

files

The files directory contains non-image files that can be downloaded from the website. This directory contains a subdirectory for each top-level page, so if I make a link to a file called mydoc.pdf in proteins.php, the file will reside in files/proteins/mydoc.pdf. More on this below.

images

The images directory contains image files. Images in each top-level page will be located in their own directory, named after the page, just like stuff in files. Sensing a theme, yet? :)

include

The include directory contains a library of PHP code that is used by pages in the top-level. Unless you're adding publication information to include/publication.php, you probably won't need to edit anything here. Steer clear of here, ya hear?

Template styling

The pages in the website derive their style information from the UNL Templates, based on a PHP PEAR framework provided by UNL. A good reference on the templates can be found here. However, while it's good to understand certain aspects of the UNL templates (e.g. content layouts), you will not be writing any HTML, so don't bury yourself in the details there.

PHP Function Reference

If you need more information about the functions you're using in the top-level web pages, you can look (don't touch!) through the PHP files in the include directory. Each function will have a comment preceding it that describes - in graphic detail - the task it performs. Enjoy!