การติดตั้ง Linux เมื่อติดตั้งเสร็จ มักจะเจอปัญหา อยู่ 2 อย่างคือ
Forbidden
You don't have permission to access /xxxx/index.php on this server.
สำหรับแนวทางการแก้ไขปัญหา ทำได้ดังนี้
ข้อที่ 1 สำหรับการเข้าไปแก้ไขปัญหา เหมือน Apache ไม่ได้ RUN
วิธีการ ให้เข้าไปกำหนดสิ่งที่เกี่ยวกับ Firewall configuration สำหรับ CentOS ให้ใช้คำสั่ง setup แล้วเลือกที่ Firewall configuration ทำการ Disable หรือ จะกำหนดให้เป็นการเฉพาะ ซึ่งมีรายการให้เลือก เท่านี้ ก็เรียบร้อย
ข้อที่ 2 สำหรับการแก้ไขปัญหา 403 Forbidden
วิธีการ สำหรับประเด็นนี้จะดูกันที่ Control of SELinux
edit the SELINUX= line in /etc/selinux/config for either 'enforcing', 'permissive', or 'disabled'. For example, SELINUX=permissive.
เป็นการเข้าไปแก้ไข การควบคุม SElinux นะครับ #nano /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=permissive
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
*********************
ทำการปรับแก้ จากเดิม SELINUX=enforcing ให้เป็น SELINUX=permissive หรือ disabled
หากต้องการรายละเอียด อ่านนี้เลยครับ
--------------------------------------------------------------------------------------------------------------
2. SELinux Modes
SELinux has three basic modes of operation, of which Enforcing is set as the installation default mode. There is, however, an additional qualifier of targeted or mls which control how pervasive SELinux rules are applied, with targeted being the less stringent level.
-
Enforcing: The default mode which will enable and enforce the SELinux security policy on the system, denying access and logging actions
-
Permissive: In Permissive mode, SELinux is enabled but will not enforce the security policy, only warn and log actions. Permissive mode is useful for troubleshooting SELinux issues
-
Disabled: SELinux is turned off
The SELinux mode can be viewed and changed by using the SELinux Management GUI tool available on the Administration menu or from the command line by running 'system-config-selinux' (the SELinux Management GUI tool is part of the policycoreutils-gui package and is not installed by default).
Users who prefer the command line may use the 'sestatus' command to view the current SELinux status:
# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 21
Policy from config file: targeted
The 'setenforce' command may be used to switch between Enforcing and Permissive modes on the fly but note that these changes do not persist through a system reboot.
ก็จะทำให้ปัญหาที่กล่าวมาหายไป แต่หากเป็น เครื่องที่ต้องกำหนดความปลอดภัยต้องดำเนินการอ่านทำความเข้าใจให้กระจ่างและทำการปรับแต่งตามต้องการนะครับ
สำหรับ ข้อมูลเพิ่มเติมสามารถอ่านได้ที่นี้