[HOW TO] 2015/10/12 15:39:35 [error] 30666#0: *5 open() "/home/www/html/index.html" failed (13: Permission denied), client: 127.0.0.1, server: **.vn, request: "GET /index.html HTTP/1.1", host: "*.**.vn"

I am creating the backup server to prepare in case of disaster. It seems well until I can not get the index.html. I use nginx as web server.

What happened? Afterwards I come to /var/log/nginx/error.log to totally view.

2015/10/12 15:39:35 [error] 30666#0: *5 open() "/home/www/html/index.html" failed (13: Permission denied), client: 127.0.0.1, server: **.vn, request: "GET /index.html HTTP/1.1", host: "*.**.vn"

Humhumhum nginx has a thorny permission. But where is it?

Because of I chowned "web root server" in nginx configuration is:
$chown -R nginx.nginx /home/www
$chmod -R /home/www

I do not know exactly what happened? Okay, I need to review with mine knowledge. Oh SELINUX, maybe it is root cause of issues. And it right!

$vi /etc/selinux/config


# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

I need to edit as below:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

And I go to reboot the server. Happily, I can open the web page.

Thank you for seeing, see you soon.

Thank you for reading this article, please a comment if you are interested.

Tiến Phan - R0039

Knowledge is Endless

Sharing for Success


0 nhận xét:

Post a Comment