Installation error (AlmaLinux 9) potentially linked to SELinux
Hello,
I'm following the documentation at https://www.phusionpassenger.com/docs/tutorials/deploy_to_production/installations/oss/ownserver/ruby/nginx/ to install passenger + nginx on AlmaLinux 9 (and later RHEL 9).
It took be a bit of time to figure out that the execution of the service failed (and why):
What I saw after following the installation steps was:
[vagrant@vagrant-worker-rhel ~]$ sudo cat /var/log/nginx/error.log
2025/09/27 12:46:11 [emerg] 17093#17093: mkdir() "/usr/share/nginx/passenger_temp" failed (13: Permission denied)
If I do this, the problem disappears and the web server boots:
sudo setenforce 0
sudo systemctl restart nginx
(of course this is only a temporary test)
Is it a known problem? What is the best / recommended solution? (e.g. using semanage to explicitely authorize access to /usr/share/nginx/passenger_temp ?)
Thank you
I ran the same set of scripts on RHEL 9, and installation works.
On AlmaLinux 9, I implemented a quick-fix this way:
- name: Quick-fix for AlmaLinux SELinux bug (https://github.com/phusion/passenger/issues/2630)
ansible.builtin.file:
path: /usr/share/nginx/passenger_temp
state: directory
owner: nginx
group: root
mode: '0700'
setype: usr_t
when: ansible_distribution == "AlmaLinux"
(followed by an extra restart)
This allows the server to boot.