README: add configure step for SELinux and systemd

To fix issues like #213, configure for SELinux
is necessary.

Signed-off-by: anatasluo <luolongjuna@gmail.com>
This commit is contained in:
anatasluo 2022-05-18 19:01:53 +08:00
parent aa34f01f35
commit 514fa38ed8

View file

@ -289,6 +289,37 @@ Finally, start the httpd server.
systemctl start httpd
----
== Configure SELinux policy
When running systemd with SELinux enabled, httpd server can only visit limited directories.
If your /path/elixir-data/ is not one of these allowed directories, you will be responded with 500 status code.
To allow httpd server to visit /path/elixir-data/, run following codes:
----
chcon -R -t httpd_sys_rw_content_t /path/elixir-data/
----
To check if it takes effect, run the following codes:
----
ls -Z /path/elixir-data/
----
In case you want to check SELinux log releated with httpd, run the following codes:
----
audit2why -a | grep httpd | less
----
== Configure systemd log directory
By default, the error log of elixir will be put in /tmp/elixir-errors.
However, systemd enables PrivateTmp by default.
And, the final error directory will be like /tmp/systemd-private-xxxxx-httpd.service-xxxx/tmp/elixir-errors.
If you want to disable it, configure httpd.service with the following attribute:
----
PrivateTmp=false
----
== Configure lighthttpd
Here's a sample configuration for lighthttpd: