DoC Computing Support Group


Differences between revisions 1 and 23 (spanning 22 versions)
Revision 1 as of 2008-06-17 14:04:31
Size: 2266
Editor: mwj
Comment:
Revision 23 as of 2018-10-27 08:55:57
Size: 6103
Editor: ldk
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
## page was renamed from services/web/personal
Line 9: Line 10:
DoC runs the [[http://httpd.apache.org/|Apache]] web server, version 2.2.6. DoC runs the [[http://httpd.apache.org/|Apache]] web server, version 2.4.7.
Line 22: Line 23:
   ~+`mkdir public_html`+~  ~+`mkdir public_html`+~
Line 26: Line 27:
   ~+`chmod a+x public_html`+~  ~+`chmod a+x public_html`+~
Line 30: Line 31:
   ~+`cd public_html`+~
   ~+`chmod a+r index.html`+~
 ~+`cd public_html`+~<<BR>>
 ~+`chmod a+r index.html`+~<<BR>>
  
 This will be your main personal web page (a.k.a. your "home page").
Line 33: Line 36:
   This will be your main personal web page (a.k.a. your "home page").  * Then for each file you have created that you want to make available on the web:
Line 35: Line 38:
    * Then for each file you have created that you want to make available on the WWW:  ~+`chmod a+r filename`+~
Line 37: Line 40:
      chmod a+r filename  * Your main personal web page, ~+`index.html`+~, will then be visible around the world as the following URL:
Line 39: Line 42:
    * Your main personal web page, index.html, will then be visible around the world as the following URL:  ~+`http://www.doc.ic.ac.uk/~username/`+~
Line 41: Line 44:
      http://www.doc.ic.ac.uk/~username/  The webserver automatically maps URLs of the form ~+`http://www.doc.ic.ac.uk/~username/X`+~ to the Unix path ~+`/homes/username/public_html/X`+~.
Line 43: Line 46:
      The web server automatically maps URLs of the form http://www.doc.ic.ac.uk/~username/ to the Unix filesystem path /homes/username/public_html/index.html.  * Other web pages in your ~+`public_html`+~ directory area will be visible as URLs of the form:
Line 45: Line 48:
    * Other web pages in your public_html directory area will be visible as URLs of the form:  ~+`http://www.doc.ic.ac.uk/~username/somefile.html`+~
Line 47: Line 50:
      http://www.doc.ic.ac.uk/~username/somefile.html Feel free to create subdirectories inside '''public_html''' for each web-based project you want, set their permissions exactly the same way.
Line 49: Line 52:
      Again, the webserver automatically maps each such URL to the filesystem path /homes/username/public_html/somefile.html. == Group project web pages ==

When you do a group project organised by your Lab Organiser, a group is created with the right members, and a group project area is created,
stored inside /vol/project. For example, 2014-15 first year Topics groups are stored in '''/vol/project/2014/163/g14163xx''' (where xx is the group no and 163 is the Topics course code).

By default, your entire group project directory (eg. '''/vol/project/2014/163/g14163xx''') is accessible via the web as URL:

        http://www.doc.ic.ac.uk/project/2014/163/g14163xx/

We strongly recommend that you prevent accidental exposure of private
information via the web by adding a very restrictive .htaccess file to
the top level directory to disallow web browsing of your entire group
project directory. For instance, a member of g14163xx
might do the following:

{{{
 cd /vol/project/2014/363/g14163xx
 echo "deny from all" > .htaccess
}}}

Then you could explicitly open up a subdirectory to the web via a similar
.htaccess ("allow from all") in that directory.. For instance:

{{{
mkdir web
echo "allow from all" > web/.htaccess
}}}

which allows access to

     http://www.doc.ic.ac.uk/project/2014/363/g14163xx/web/

Permissions are also important in group directories, essentially all members of the group must be
able to write files and create new directories in there, and the web server must be able to read all
the files. We recommend the following:

.We recommend the following simple rules for keeping permissions in
your group project directory sensible:

 * All members of the group should set 'umask 002' before working in the group project directory. This ensures that all new files/dirs are user-writable, group-writable and other-readable. In fact, it is best for the duration of the project if each group member adds 'umask 002' to the end of their ~/.cshrc file.

 * Whenever a group member creates a new subdirectory in the group directory, you should do "chmod g+ws NEW_DIR_NAME". This will ensure that newly created files/dirs within that directory inherit the group ownership from the parent (i.e. be group-owned by the project group) rather than reverting to be group-owned by your primary group.

== Editing your personal web pages under Windows ==

CSG do not advise editing web pages on Windows due to incompatibilities between line-endings on Windows and Unix. More precisely, '''you must not edit CGI scripts on Windows''', as the line-ending incompatibility will stop the script from running completely.

If you must edit plain HTML web pages on Windows, proceed as follows:

 * Once you have a public_html folder you can save files to it from Windows systems with the correct permissions in the following way:

   * Right click on '''My Computer'''.

   * Look at your H: drive, that should be labelled with the UNC eg. \\redkite\dcw. You'll need to use the server name (eg. redkite) below.

   * Select '''Map Network Drive''', then In the '''Folder:''' box type:

   ~+`\\SERVERNAME\public_html`+~

  * where SERVERNAME is replaced by the name of server, eg. redkite.

   * Tick '''Reconnect at logon'''.

   * Click '''Ok'''.

 * Note the drive letter that the folder is allocated to, and always save web pages to this location. The reason for this is that the user files saved to your home directory via the H: drive is private. Files saved directly to the ~+`public_html`+~ share are publicly readable.

== For more info ==

We have two more detailed guides about CGI scripts:

  * [[guides/web/cgi|General CGI Script Notes]]
  * [[guides/web/php|More specific notes about making PHP scripts run]]

and a guide on:

  * [[guides/web/security|Restricting access to web pages]]

Personal web pages

This page covers the personal web page service operated by CSG for DoC staff and students. The commands listed here should be run on a DoC Linux workstation or remote access server.

Note: All pages hosted on DoC or other College resources must be non-political, legal, and must not bring the Department or the College into disrepute. Your personal web page must contain a link back to the Department's home page. In short, any content you publish via our resources must abide by the Departmental and College regulations.

Enabling your personal web pages

DoC runs the Apache web server, version 2.4.7.

  • Make your home directory publicly accessible (but not readable!):

    chmod a+x ~

    Note: On directories, the permissions set by the chmod command are interpreted as follows:

    • r = permission to get a directory listing

    • w = permission to create and delete files in the directory

    • x = permission to access files in the directory provided the name of the files are known

  • If it doesn't already exist, create a directory called public_html:

    mkdir public_html

  • Make this subdirectory publicly accessible:

    chmod a+x public_html

  • Create a file called index.html within this directory and make this readable by all:

    cd public_html
    chmod a+r index.html
    This will be your main personal web page (a.k.a. your "home page").

  • Then for each file you have created that you want to make available on the web:

    chmod a+r filename

  • Your main personal web page, index.html, will then be visible around the world as the following URL:

    http://www.doc.ic.ac.uk/~username/

    The webserver automatically maps URLs of the form http://www.doc.ic.ac.uk/~username/X to the Unix path /homes/username/public_html/X.

  • Other web pages in your public_html directory area will be visible as URLs of the form:

    http://www.doc.ic.ac.uk/~username/somefile.html

Feel free to create subdirectories inside public_html for each web-based project you want, set their permissions exactly the same way.

Group project web pages

When you do a group project organised by your Lab Organiser, a group is created with the right members, and a group project area is created, stored inside /vol/project. For example, 2014-15 first year Topics groups are stored in /vol/project/2014/163/g14163xx (where xx is the group no and 163 is the Topics course code).

By default, your entire group project directory (eg. /vol/project/2014/163/g14163xx) is accessible via the web as URL:

We strongly recommend that you prevent accidental exposure of private information via the web by adding a very restrictive .htaccess file to the top level directory to disallow web browsing of your entire group project directory. For instance, a member of g14163xx might do the following:

 cd /vol/project/2014/363/g14163xx
 echo "deny from all" > .htaccess

Then you could explicitly open up a subdirectory to the web via a similar .htaccess ("allow from all") in that directory.. For instance:

mkdir web
echo "allow from all" > web/.htaccess

which allows access to

Permissions are also important in group directories, essentially all members of the group must be able to write files and create new directories in there, and the web server must be able to read all the files. We recommend the following:

.We recommend the following simple rules for keeping permissions in your group project directory sensible:

  • All members of the group should set 'umask 002' before working in the group project directory. This ensures that all new files/dirs are user-writable, group-writable and other-readable. In fact, it is best for the duration of the project if each group member adds 'umask 002' to the end of their ~/.cshrc file.
  • Whenever a group member creates a new subdirectory in the group directory, you should do "chmod g+ws NEW_DIR_NAME". This will ensure that newly created files/dirs within that directory inherit the group ownership from the parent (i.e. be group-owned by the project group) rather than reverting to be group-owned by your primary group.

Editing your personal web pages under Windows

CSG do not advise editing web pages on Windows due to incompatibilities between line-endings on Windows and Unix. More precisely, you must not edit CGI scripts on Windows, as the line-ending incompatibility will stop the script from running completely.

If you must edit plain HTML web pages on Windows, proceed as follows:

  • Once you have a public_html folder you can save files to it from Windows systems with the correct permissions in the following way:
    • Right click on My Computer.

    • Look at your H: drive, that should be labelled with the UNC eg. \\redkite\dcw. You'll need to use the server name (eg. redkite) below.
    • Select Map Network Drive, then In the Folder: box type:

      \\SERVERNAME\public_html

    • where SERVERNAME is replaced by the name of server, eg. redkite.
      • Tick Reconnect at logon.

      • Click Ok.

  • Note the drive letter that the folder is allocated to, and always save web pages to this location. The reason for this is that the user files saved to your home directory via the H: drive is private. Files saved directly to the public_html share are publicly readable.

For more info

We have two more detailed guides about CGI scripts:

and a guide on:

 
 

guides/web/personal (last edited 2018-10-27 08:55:57 by ldk)