nginx - 禁用除服务器块之外的目录访问
问题描述
我的 nginx 服务器块
server {
listen 80;
root /var/www/html/blog;
index index.php index.html index.htm;
运行 wordpress 的服务器。我想限制 PHP 仅访问 /var/www/html/blog。访问 /var/www/html/web 等其他目录的请求将被阻止。
我试过的-
location ~ ^/(?!(blog)/?) {
deny all;
access_log off;
log_not_found off;
}
怎么做?
解决方案
推荐阅读
- mysql - 使用多对多关系表查找值
- java - Struts 1.3 中的过滤器列表
- jenkins - 擦除 Jenkins 环境变量
- javascript - 是否有可能在 Firebase 上为移动应用创建帐户并让用户使用预设凭据登录?
- ios - 如何使用 NSFetchRequest 和 fetchLimit = 1 从核心数据中获取 0 或 1 个实体?
- php - 如何在我保存的 laravel 中获得无限级别的菜单
- python - 如何在 django 中创建没有应用程序的模型?
- c# - MoveTo 在本地实例上工作,Azure 中的身份验证错误
- python - 我在 python 中编写了一个动画代码,但它给出了 modulenotfounderror 。没有名为 vector 的模块。能不能解释一下原因。请
- oracle - 通过来自 oracle 数据库的 post 请求发送大量数据