Ask Your Question
1

Cannot change root of nginx installation (Fedora 29)

asked 2018-11-28 12:54:34 -0500

Mazzofab gravatar image

updated 2018-11-28 13:49:21 -0500

I'm facing an issue on Fedora 29. I have installed nginx from dnf and the only thing I need to do is to change the root directive in nginx.conf so I can start developing my project. The basic installation works great with PHP in /usr/share/nginx/html.

If I change the directive "root /usr/share/nginx/html;" to "root /my_project;" for example, everything doesn't work anymore. The directory obviously exists as I have created it and I have given permissions to the nginx user to read and write (copied from the original dir).

No clues on what I am doing wrong.

edit retag flag offensive close merge delete

Comments

My guess is selinux. Why not use the default directory?

Panther gravatar imagePanther ( 2018-11-28 13:59:24 -0500 )edit

Indeed that was the issue! Thanks a lot and from answer below managed to solve!

Mazzofab gravatar imageMazzofab ( 2018-11-28 14:19:51 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-11-28 14:02:59 -0500

aeperezt gravatar image

Did you change the SELinux propierty for the folder at /my_project it should be set to system_u:object_r:httpd_sys_content_t:s0 to verify what context it has do

ls -laZ /my_project

if it is not set you need to do

chcon -R -t httpd_sys_content_rw_t /my_project

if still do not work check you SELinux logs

Good Luck

edit flag offensive delete link more

Comments

1

The problem with this answer is chcon is TEMPORARY. see https://docs.fedoraproject.org/en-US/...

Panther gravatar imagePanther ( 2018-11-28 16:14:41 -0500 )edit
1

You want /usr/sbin/semanage fcontext -a -t httpd_sys_content_rw_t /my_project

Panther gravatar imagePanther ( 2018-11-28 16:17:31 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-11-28 12:54:34 -0500

Seen: 67 times

Last updated: Nov 28 '18