Both sides previous revisionPrevious revisionNext revision | Previous revision |
cern:website [2020/05/13 11:55] – [Copy to eos] iwn | cern:website [2024/08/21 15:43] (current) – removed iwn |
---|
====== Personal CERN website ====== | |
| |
You can make a personal website to share documents in your ''/afs'' or ''/eos'' directory via the World Wide Web. Please follow the instructions on [[https://cernbox-manual.web.cern.ch/cernbox-manual/en/web/|this page]]. | |
===== Setup ===== | |
| |
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: | |
<file bash .htaccess> | |
SSLRequireSSL # The modules only work using HTTPS | |
| |
AuthType shibboleth | |
ShibRequireSession On | |
ShibRequireAll On | |
ShibExportAssertion Off | |
Require valid-user | |
Require ADFS_GROUP cms-physics-access | |
| |
Options +Indexes | |
</file> | |
| |
Other AD FS groups can be found in CERN's [[https://e-groups.cern.ch/e-groups/EgroupsSearch.do|E-groups]]. | |
| |
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]]. | |
| |
<wrap tip>Pro tip</wrap> Add the following line in your ''.htaccess'' if you want to have one default index file for all subdirectories: | |
<code bash> | |
DirectoryIndex index.html index.php /<user>/index.php | |
</code> | |
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: | |
<code> | |
<?php | |
$pwd = preg_replace("|^\/((\w)\w+)\/|","/eos/user/$2/$1/www/",$_SERVER["REQUEST_URI"]); | |
$pwd = preg_replace("(\?.*)","",$pwd); | |
chdir($pwd); | |
?> | |
</code> | |
| |
<wrap tip>Pro tip</wrap> You can set the way the certain files types are opened by adding the following lines to your ''.htaccess'' file: | |
<code> | |
<Files *.log> | |
ForceType text/plain | |
Header set Content-Type "text/plain" | |
</Files> | |
</code> | |
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): | |
<code> | |
<FilesMatch "\.(?i:log|py|sh)$"> | |
ForceType text/plain | |
Header set Content-Type "text/plain" | |
</FilesMatch> | |
</code> | |
| |
<wrap tip>Pro tip</wrap> To make a subdirectory public for everyone with the correct link, you can create a new ''.htaccess'' in that directory with the following lines: | |
<file bash .htaccess> | |
SSLRequireSSL # The modules only work using HTTPS | |
Satisfy Any | |
Allow From All | |
Options +Indexes | |
</file> | |
| |
| |
===== Copy to eos ===== | |
| |
EOS is now mounted on PSI T3, so you mount with | |
<code bash> | |
mkdir ~/eos | |
sshfs -o allow_other,reconnect ineuteli@lxplus.cern.ch:/eos/user/${USER::1}/$USER/ ~/eos | |
</code> | |
Make sure not to forget or add anymore trailing ''/''. | |
With each new session, you can remount using | |
<code bash> | |
fusermount -u ~/eos | |
</code> | |
You can put this alias in your ''.bashrc'': | |
<code bash> | |
alias meos='fusermount -u ~/eos && sshfs -o allow_other,reconnect $USER@lxplus.cern.ch:/eos/user/${USER::1}/$USER/ ~/eos && echo "~/eos" && lt ~/eos' | |
</code> | |
| |
Alternatively, use secure copy ''scp'' to copy stuff from your local computer or from PSI T3 to your ''/eos'': | |
<code bash> | |
scp test.txt <user>@lxplus.cern.ch:/eos/user/<letter>/<user>/www/ | |
</code> | |
| |
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]]). | |