Reason 1: no index.html
$ nginx -V // check your prefix location. For example
$ cd /usr/share/nginx/html // There is no index.html file, so
$ vi index.html
- check if the
user
innginx.con
isroot
or has permission to read the folder - check if the directory’s permission is 751
- check if SWLinux is open (disable it if open)
$ getenforce
$ sestatus (or)
Reason 2: check user in nginx.conf
$ ls -la
$ chmod 751 {file/dir}
–rw-r–r– file and drwxr-xr-x directory permission explained
First character | Description |
---|---|
- | Regular file. |
b | Block special file. |
c | Character special file. |
d | Directory. |
l | Symbolic link. |
p | FIFO. |
s | Socket. |
w | Whiteout. |
Three permission triads defined what the user/group/others can do | First triad defines what the owner can do | Second triad explains what the group members can do | Third triad defines what other users can do |
---|---|---|---|
-rw-r--r-- | Owner has only read and write permission (rw-) | Group has read permission (r--) | Others has read permission (r--) |
drwxr-xr-x | Owner has full permission (rwx) | Group has read and execute permission (r-x) | Others has read and execute permission (r-x) |
// check file state
$ stat file
change owner and group
$ chown owner-user file
$ chown owner-user:owner-group file
$ chown owner-user:owner-group directory
$ chown options owner-user:owner-group file