| 1 | !! |
| 2 | $DPP "Groupnix User Websites" "User Websites" <template/head.html #> |
| 3 | $DPP <template/bar.html #> |
| 4 | !! |
| 5 | |
| 6 | <p> |
| 7 | Each user on Groupnix has access to their own website. If your user is USER, |
| 8 | then your website can be found at <code>https://u.buni.party/USER</code>. |
| 9 | </p> |
| 10 | |
| 11 | <h3>Filesystem Structure</h3> |
| 12 | <p> |
| 13 | Your user website is stored in <code>~/web</code>. This directory has the |
| 14 | following hierarchy: |
| 15 | </p> |
| 16 | <pre><code> |
| 17 | ~/web/ |
| 18 | |__ noserv/ |
| 19 | | |__ secrets |
| 20 | |__ cgi-bin/ |
| 21 | | |__ hello.sh* |
| 22 | |__ index.html |
| 23 | </code></pre> |
| 24 | <p> |
| 25 | Your <code>web</code> directory should be owned by your user but have the group |
| 26 | <code>www-data</code>. It will also have the SGID bit. These two things should |
| 27 | not be changed since they allow nginx (which is the HTTP server being used on |
| 28 | Groupnix) to actually access your website and serve it. Additionally, you should |
| 29 | not change the owner/group of any files you add in the <code>web</code> |
| 30 | directory. |
| 31 | </p> |
| 32 | <p> |
| 33 | The <code>cgi-bin</code> directory can hold |
| 34 | <a class="out" href="https://en.wikipedia.org/wiki/Common_Gateway_Interface">CGI scripts</a>. |
| 35 | This means that files in that directory (if they are marked executable) will be |
| 36 | run as scripts instead of being served statically. This allows you to create |
| 37 | dynamic websites. Note, however, that CGI scripts will run as the www-data user |
| 38 | and so only have access to your <code>~/web</code> directory, not your whole |
| 39 | user directory. |
| 40 | </p> |
| 41 | <p> |
| 42 | Finally, the <code>noserv</code> directory contains anything that you do not |
| 43 | want nginx to serve. So, if you have a file <code>noserv/secrets</code>, then |
| 44 | the endpoint <code>https://u.buni.party/USER/noserv/secrets</code> will fail. |
| 45 | </p> |
| 46 | |
| 47 | <h3>Using the Web</h3> |
| 48 | <p> |
| 49 | Given a URL, the web server will either try to find a matching file in your web |
| 50 | directory or, if it finds a directory instead, will try to serve |
| 51 | <code>index.html</code> in that directory. If the path is in the |
| 52 | <code>cgi-bin</code> directory, the CGI script will be executed and its output |
| 53 | will be served as the web page. It is important to note that paths in your HTML |
| 54 | documents must be relative or absolute with respect to your current user. For |
| 55 | instance, if you are USER and you want to link your stylesheet, you must use a |
| 56 | relative path of the form <code>style.css</code> or an absolute path of the form |
| 57 | <code>/USER/style.css</code>. |
| 58 | </p> |
| 59 | |
| 60 | !!$DPP <template/foot.html #> |
| 61 | |