User Tools

Site Tools


cern:website

Personal CERN website

You can make a personal website to share documents in your EOS directory via the World Wide Web. Please follow the instructions on this page.

The steps are basically:

  1. Create a /eos/user/${USER::1}/$USER/www directory on EOS (lxplus).
  2. Promote it to a website via CERNBox and CERN Web services.
  3. Configure access with .htaccess.
  4. Configure each webpage with an index file (index.html or index.php).
  5. Add content.

Setup

Setup access

You need to configure access to CMS members as described here with an Apache .htaccess file in you www folder:

.htaccess
SSLRequireSSL # The modules only work using HTTPS
 
AuthType openid-connect
  Require valid-user
AuthType openid-connect
Require claim cern_roles:view-site-root
 
Options +Indexes

Other AD FS groups can be found in CERN's E-groups.

Setup index

If you want to display documents and directories in a custom style (in particular plots), you can add an index.html or index.php file, for example this one.

Pro tip Add the following line in your .htaccess if you want to have one default index file for all subdirectories:

DirectoryIndex index.html index.php /<user>/index.php

If someone opens your link to some directory, the browser will first look for a index.html file in that directory, otherwise for index.php. If it does not find any of those, it will look for index.php in your root /<user>/ directory (which corresponds to your www directory on /eos). If your php files needs to access local files, you might need to change the working directory by adding the following line at the beginning of you file:

<?php
$pwd = preg_replace("|^\/((\w)\w+)\/|","/eos/user/$2/$1/www/",$_SERVER["REQUEST_URI"]);
$pwd = preg_replace("(\?.*)","",$pwd);
chdir($pwd);
?>

Pro tip You can set the way the certain files types are opened by adding the following lines to your .htaccess file:

<Files *.log>
  ForceType text/plain
  Header set Content-Type "text/plain"
</Files>

In this way .log files accessible on your website will be opened as a plain ASCII text file in the browser, instead of being downloaded. More content types (“MIME types”) can be found here. To configure multiple extensions in the same way (?i: is for case-insensitivity):

<FilesMatch "\.(?i:log|py|sh|tex)$">
  ForceType text/plain
  Header set Content-Type "text/plain"
</FilesMatch>

<Files *.rtf>
  ForceType text/rtf
  Header set Content-Type "text/rtf"
</Files>

Pro tip To make a subdirectory public for everyone with the correct link, you can create a new .htaccess in that directory with the following lines:

.htaccess
SSLRequireSSL # The modules only work using HTTPS
Satisfy Any
Allow From All
Options +Indexes

Copy to eos

EOS is now mounted on PSI T3, so you mount with

kinit $USER@CERN.CH && eosfusebind -g krb5 $HOME/krb5cc_$UID

or (outdated)

mkdir ~/eos
sshfs -o allow_other,reconnect ineuteli@lxplus.cern.ch:/eos/user/${USER::1}/$USER/ ~/eos

Make sure not to forget or add anymore trailing /. With each new session, you can remount using

fusermount -u ~/eos

Pro tip You can put this alias in your .bashrc:

alias meos='fusermount -u ~/eos && sshfs -o allow_other,reconnect $USER@lxplus.cern.ch:/eos/user/${USER::1}/$USER/ ~/eos && echo "~/eos" && lt ~/eos'

Alternatively, use secure copy scp to copy stuff from your local computer or from PSI T3 to your /eos:

scp test.txt <user>@lxplus.cern.ch:/eos/user/<letter>/<user>/www/

It is also possible to mount your personal /eos directory to your local computer with an CERN Box desktop app (video tutorial).

cern/website.txt · Last modified: 2023/09/29 17:29 by iwn