======= 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 [[https://cernbox-manual.web.cern.ch/cernbox-manual/en/web/|this page]].
The steps are basically:
- Create a ''/eos/user/${USER::1}/$USER/www'' directory on EOS (''lxplus'').
- Promote it to a website via CERNBox and CERN Web services.
- Configure access with ''.htaccess''.
- Configure each webpage with an index file (''index.html'' or ''index.php'').
- Add content.
===== Setup =====
==== Setup access ====
You need to configure access to CMS members as described [[https://espace.cern.ch/webservices-help/websitemanagement/ConfiguringAFSSites/Pages/AccesscontrolonAFSsites.aspx|here]] with an Apache ''[[https://httpd.apache.org/docs/2.4/howto/htaccess.html|.htaccess]]'' file in you ''www'' folder:
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 [[https://e-groups.cern.ch/e-groups/EgroupsSearch.do|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 [[cern:index|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 //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 ''//'' 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:
Pro tip You can set the way the certain files types are opened by adding the following lines to your ''.htaccess'' file:
ForceType text/plain
Header set Content-Type "text/plain"
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 [[https://www.lifewire.com/file-extensions-and-mime-types-3469109|here]]. To configure multiple extensions in the same way (''?i:'' is for case-insensitivity):
ForceType text/plain
Header set Content-Type "text/plain"
ForceType text/rtf
Header set Content-Type "text/rtf"
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:
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 @lxplus.cern.ch:/eos/user///www/
It is also possible to mount your personal ''/eos'' directory to your local computer with an [[https://cernbox.cern.ch/cernbox/doc/clients.html|CERN Box desktop app]] ([[https://cds.cern.ch/record/2288368|video tutorial]]).