【问题标题】:Apache 403 Permission DeniedApache 403 权限被拒绝
【发布时间】:2015-09-05 22:05:44
【问题描述】:

我正在尝试访问一个使用 Apache 运行的网站。问题是我得到一个 403 错误并且只登陆 Permission Denied 错误页面。后端等本身正在使用 Django。

我从错误日志中得到的信息:

(13)权限被拒绝:访问/index/被拒绝

我还将默认的 apache conf 编辑为:

<VirtualHost *:80>

DocumentRoot /var/www

<Directory />
        Options FollowSymLinks
        AllowOverride None
</Directory>
<Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerM$
        Order allow,deny
        Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, $
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/acess.log combined

ServerAdmin webmaster@localhost

WSGIDaemonProcess djangoapps python-path=/home/djangoa$
WSGIProcessGroup djangoapps
WSGIScriptAlias / /home/djangoapps/plugit/wsgi.py

<Directory /home/djangoapps/plugit>
        <Files wsgi.py>
                Require all granted
        </Files>
</Directory>

</VirtualHost>

加载的(我希望)wsgi.py 文件不包含比默认内容更多的内容。我还在项目中的所有内容上设置了www-data:www-data..

【问题讨论】:

标签: python django apache http-status-code-403


【解决方案1】:

您使用的是哪个操作系统?您是否获得了对服务器的 root 访问权限?如果是,请检查 SELinux 是否已禁用。如果没有,则通过在服务器终端上运行 setenforce 0 来禁用它。


问。 SELinux 是什么?

A. Security-Enhanced Linux (SELinux) 是一个类似于 AppArmour 的 Linux 内核安全模块(一种系统防火墙)。

【讨论】:

  • 哦,我应该加上那个。它是我运行 Debian 7 的虚拟服务器,我是它的根。 setenforce 似乎并不存在。一些谷歌搜索告诉我echo 0&gt;/selinux/enforce 应该这样做。不幸的是没有任何改变。 =(
  • 更改后是否重启了服务器?
  • 如果是,但仍然无法正常工作,请检查此文件是否存在:/etc/selinux/config,如果存在,请对其进行编辑并通过查找以下行确保 SeLinux 已禁用:SELINUX=disabled跨度>
  • /etc/selinux 有 2 个文件:semanage.config 和 config。 semanage.config 现在主要是 text/cmets,config 是空的。
  • 嗯。如果是这种情况,请在下面添加SELINUX=disabled 并重新启动您的服务器。看看有没有帮助。
猜你喜欢
  • 1970-01-01
  • 2012-08-13
  • 2014-06-29
  • 2017-04-10
  • 2016-04-21
  • 1970-01-01
  • 2018-06-11
相关资源
最近更新 更多