Wiki source code of Interactive Web Sites
Last modified by Thomas Coelho (local) on 2024/07/03 10:58
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | By default you can put static web content in the public_html directory located in your home directory. This content is reachable with [[https:~~/~~/itp.uni-frankfurt.de/~~~~username>>https://itp.uni-frankfurt.de/~~username]]. |
| 2 | |||
| |
4.1 | 3 | There may be reasons that you need some server site processing like php stuff. The following article describes how this is implemented and how you can interactive with it. |
| |
1.1 | 4 | |
| 5 | = Design = | ||
| 6 | |||
| 7 | It is based on systemd services. Like any system service, services can also run in a user context and under control of the user. Instead of a common web server which delivers files from the public_html directory, a dedicated Apache instance is executed in the users context. There are some prerequisites, which must configure by the admins: | ||
| 8 | |||
| |
3.4 | 9 | 1. A lingering user session. Normally the session is started with the login of the user. A lingering session is started on boot. This allows the start the services at boot time. |
| |
4.1 | 10 | 1. A Proxy redirect. The frontend reverse proxy must be configured to forward requests to the specific Apache instance. This allows also second level domains. |
| |
1.2 | 11 | |
| 12 | = Setting up = | ||
| 13 | |||
| |
3.1 | 14 | On the web server (this is currently **web3**) the script **install-apache-worker** needs to be run to prepare the environment after the prerequisites have been set up. The main job of the script it to prepare the runtime environment below .apache-service and to install the systemd service file. This can be read (and modified if needed) in **.config/systemd/user/apache-worker.service.** |
| |
1.2 | 15 | |
| 16 | {{code language="systemd"}} | ||
| 17 | [Unit] | ||
| 18 | Description=Apache Userspace worker for thw | ||
| 19 | RequiresMountsFor=/home/thw | ||
| 20 | ConditionHost=web3 | ||
| 21 | |||
| 22 | [Service] | ||
| 23 | ExecStart=/usr/sbin/apache2 -d/home/thw/.apache-service -DNO_DETACH | ||
| 24 | WorkingDirectory=/home/thw | ||
| 25 | |||
| 26 | [Install] | ||
| 27 | WantedBy=default.target | ||
| 28 | |||
| 29 | {{/code}} | ||
| 30 | |||
| |
2.1 | 31 | On the host in ConditionHost you can control the service witch systemctl ~-~-user. |
| 32 | |||
| 33 | {{code language="none"}} | ||
| 34 | systemctl --user status apache-worker | ||
| 35 | |||
| 36 | {{/code}} | ||
| 37 | |||
| 38 | Replace status with stop/start/restart to control the job, | ||
| 39 | |||
| 40 | Logfiles are written to .apache-service/log. The Logfiles are rotated by rotatelogs which is as a pipe for the logfiles, |