Editing the group website: Difference between revisions

From Powers Wiki
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:


==Logging into the server==
==Logging into the server==
Logging into [http://bionmr.unl.edu bionmr] is identical to logging into [http://bionmr-c1.unl.edu bionmr-c1]. You'll need the same RSA key, username and password. If you're on linux, you're already set up:
Logging into [http://bionmr.unl.edu bionmr] is done via simple keyed secure shell. You'll need the same RSA key, username and password. If you're on linux, you're already set up:


  ssh bionmr.unl.edu
  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''.
On windows, you'll need to copy the PuTTY session to a new name, and edit the hostname to ''bionmr''.


==Uploading files to the server==
==Uploading files to the server==
Line 29: Line 29:


==Directory structure==
==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 http://bionmr.unl.edu/nmr.php] will be '''nmr.php'''). Please notice that all the files are owned by the '''apache''' user with rw-r--r-- (644) permissions. To copy a file into this directory, use the following command:
The website data is located in '''/var/www'''. Documents available on the top-level of the server are found here (e.g. [http://bionmr.unl.edu/nmr.php http://bionmr.unl.edu/nmr.php] will be '''nmr.php'''). Please notice that all the files are owned by the '''www-data''' user with rw-r--r-- (644) permissions. Directories are also owned by the '''www-data''' user with rwxr-xr-x (755) permissions.


sudo install -v -m 644 -o apache -g apache /path/to/file /var/www/localhost/htdocs/new-filename
You will have to prefix any commands that change files with '''sudo''', since everything is owned by the web server. Here is an example of what making a new directory looks like:


Again, because files are owned by '''apache''', you have to use '''sudo vi''' to edit them. It's rare that you'll need to create a new directory, but in that case, you can use the following command:
sudo install -v -d -m 755 -o www-data -g www-data ''new_directory_name''


  sudo install -v -m 755 -o apache -g apache -d /var/www/localhost/htdocs/new-dirname
Here's what copying a file from your current directory into '''/var/www''' looks like:
 
  sudo install -v -m 644 -o www-data -g www-data my_file /var/www/
 
Here's what editing a file looks like:
 
sudo vi ''file_to_edit''


A few special subdirectories exist here that you need to know about.
A few special subdirectories exist here that you need to know about.
Line 64: Line 70:
==PHP Function Reference==
==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 [[:Wikipedia:PHP|PHP]] files in the '''include''' directory. Each function will have a comment preceding it that describes - in graphic detail - the task it performs. Enjoy!
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 [[:Wikipedia:PHP|PHP]] files in the '''include''' directory. Each function will have a comment preceding it that describes - in graphic detail - the task it performs. Enjoy!
[[category:Sysadmin]]

Latest revision as of 14:08, 7 August 2015

The group website is located on bionmr, in a typical LAMP configuration. The server has no NFS 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 or Samba. 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 done via simple keyed secure shell. 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.

Uploading files to the server

From Linux

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. You could also scp the files to your home directory on bionmr, if you want to.

From Windows

To copy a file from a windows machine to bionmr, map a network drive to \\bionmr\myusername where myusername is your user name. You can then copy files into that share, which is your home directory. From there, you can ssh into bionmr and play with the files as desired.

Editing the website

Directory structure

The website data is located in /var/www. 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 www-data user with rw-r--r-- (644) permissions. Directories are also owned by the www-data user with rwxr-xr-x (755) permissions.

You will have to prefix any commands that change files with sudo, since everything is owned by the web server. Here is an example of what making a new directory looks like:

sudo install -v -d -m 755 -o www-data -g www-data new_directory_name

Here's what copying a file from your current directory into /var/www looks like:

sudo install -v -m 644 -o www-data -g www-data my_file /var/www/

Here's what editing a file looks like:

sudo vi file_to_edit

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.

Image size requirements

Images on the website must conform to the current page style, so each type of image has size requirements, detailed below.

  • Images inline with paragraphs of text must have width 700px.
  • Images in picture gallery sections: largest dimension (width or height) must not exceed 750px.
  • Images for group member pictures must be exactly 210x158px.
  • Images for new page links on nmr.php or software.php must be 210x156px.

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!