Skip to content

Update docs ch05-webpage.md#817

Closed
thereisnouser wants to merge 1 commit intoXTLS:mainfrom
thereisnouser:patch-1
Closed

Update docs ch05-webpage.md#817
thereisnouser wants to merge 1 commit intoXTLS:mainfrom
thereisnouser:patch-1

Conversation

@thereisnouser
Copy link

Added read and execute permissions for all users on the web directory:

chmod -R a+rX .

Why:
Without the execute (x) permission on directories, nginx cannot access files inside them, even if the files themselves are readable.

As a result:

  • index.html exists on disk
  • nginx returns 403 Forbidden or an empty response
  • the page is not displayed

Result:
With correct directory permissions, nginx can properly access the directory and serve index.html

@Fangliding
Copy link
Member

据我所知mkdir出来的文件权限为755应该不需要手动再赋予执行权限

@Fangliding Fangliding closed this Feb 7, 2026
@thereisnouser
Copy link
Author

thereisnouser commented Feb 7, 2026

Given that 755 may not be set on the home and user directories (by default they can be 700), it would be more reasonable to adjust this command, because Nginx simply won’t be able to traverse those directories. Possibly on Debian-10 this issue won’t appear, but if someone (for example, me) is using Debian-13, problems will already occur

@Fangliding
Copy link
Member

如果是上级目录缺少执行权限那给予这个文件夹执行权限也是不能正常执行的

@thereisnouser
Copy link
Author

That statement is correct in general.
If a parent directory lacks execute permission, adding execute permission only to a child directory will not help.
However, in my case the missing execute permission was on the home directory itself, and the command was executed from ~, so it added execute permission to that parent directory. That is why traversal started working for Nginx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants