Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the Forbidden error of Nginx 403 caused by permission problem

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to solve Nginx 403 Forbidden errors caused by permission problems". In daily operation, I believe many people have doubts about how to solve Nginx 403 Forbidden errors caused by permission problems. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer "how to solve Nginx 403 Forbidden errors caused by permission problems". Next, please follow the editor to study!

Today, when you install nginx on a new environment, you end up visiting 403s.

Usually when it shows 403, I immediately think that the path is not configured correctly, but I took a closer look at it and found that the directory path is fine:

Nginx.conf:

The copy code is as follows:

Server {

Listen 80

Server_name localhost

# charset koi8-r

# access_log logs/host.access.log main

Location / {

Root/ root/html

Index index.html index.htm

}

}

Path query results in the system:

The copy code is as follows:

[root@lizhong html] # ll / root/html/

Total dosage 4

-rw-r--r-- 1 root root 3 April 18 11:07 index.html

Directory exists, restart nginx or this error, later thought is not the permission problem? So add a line to the nginx.conf header:

The copy code is as follows:

User root

Restart nginx and access it again, and you can access it normally.

Restart nginx and access it again, and you can access it normally.

If you do not want to use the root user to run, you can solve the 403 problem by modifying the directory access rights, but you can also solve the permission problem by putting the directory under the root user host directory, putting it in any location and giving it 755, or changing its owner's identity to the nginx running identity through chown.

At this point, the study on "how to solve Nginx 403 Forbidden errors caused by permission problems" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report