标签: http-status-code-403

403 Forbidden vs 401 Unauthorized HTTP响应

对于存在的网页,但对于没有足够权限的用户(他们未登录或不属于正确的用户组),要提供的正确HTTP响应是什么?401?403?别的什么?到目前为止,我对每个人的看法都不太清楚.哪些用例适合每个响应?

http-status-codes http-response-codes http-headers http-status-code-403 http-status-code-401

2544
推荐指数
18
解决办法
97万
查看次数

错误消息"禁止您无权访问/在此服务器上"

我自己配置​​了Apache,并尝试在虚拟主机上加载phpMyAdmin,但我收到了:

403禁止您无权访问此服务器上的/

我的httpd.conf

#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see 
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. …
Run Code Online (Sandbox Code Playgroud)

apache configuration httpd.conf http-status-code-403

515
推荐指数
13
解决办法
216万
查看次数

Nginx 403禁止所有文件

我在CentOS 5机器上安装了带有PHP-FPM的nginx,但我很难让它为我的任何文件服务 - 无论是否PHP.

Nginx作为www-data:www-data运行,默认的"欢迎使用EPEL上的nginx"站点(由root拥有:具有644权限的root)加载正常.

nginx配置文件有/etc/nginx/sites-enabled/*.conf的include指令,我有一个配置文件example.com.conf,因此:

server {
 listen 80;

 Virtual Host Name
 server_name www.example.com example.com;


 location / {
   root /home/demo/sites/example.com/public_html;
   index index.php index.htm index.html;
 }

 location ~ \.php$ {
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  fastcgi_param  PATH_INFO $fastcgi_script_name;
  fastcgi_param  SCRIPT_FILENAME  /home/demo/sites/example.com/public_html$fastcgi_script_name;
  include        fastcgi_params;
 }
}
Run Code Online (Sandbox Code Playgroud)

尽管public_html由www-data:www-data拥有2777文件权限,但该网站无法提供任何内容 -

 [error] 4167#0: *4 open() "/home/demo/sites/example.com/public_html/index.html" failed (13: Permission denied), client: XX.XXX.XXX.XX, server: www.example.com, request: "GET /index.html HTTP/1.1", host: "www.example.com"
Run Code Online (Sandbox Code Playgroud)

我发现很多其他帖子的用户从nginx获得403s,但我见过的大部分都涉及使用Ruby/Passenger进行更复杂的设置(过去我实际上已成功)或者只是在上游PHP时收到错误-FPM参与其中,所以他们似乎没什么帮助.

我在这做过傻事吗?

php centos nginx http-status-code-403

184
推荐指数
6
解决办法
22万
查看次数

Nginx 403错误:禁止[文件夹]的目录索引

我有3个域名,我正在尝试使用Nginx在一台服务器(数字海洋液滴)上托管所有3个站点.

mysite1.name mysite2.name mysite3.name

其中只有一个有效.另外两个导致403错误(以相同的方式).

在我的nginx错误日志中,我看到:[error] 13108#0: *1 directory index of "/usr/share/nginx/mysite2.name/live/" is forbidden.

我的网站启用配置是:

server {
        server_name www.mysite2.name;
        return 301 $scheme://mysite2.name$request_uri;
}
server {
        server_name     mysite2.name;

        root /usr/share/nginx/mysite2.name/live/;
        index index.html index.htm index.php;

        location / {
                try_files $uri $uri/ /index.html index.php;
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}
Run Code Online (Sandbox Code Playgroud)

所有3个站点都有几乎相同的配置文件.

每个站点的文件都在/usr/share/nginx/mysite1.name/someFolder等文件夹中,然后/usr/share/nginx/mysite1.name/live是一个符号链接.(与mysite2和mysite3相同.)

我看过禁止所有文件的Nginx 403,但这没有用.

关于可能出错的任何想法?

configuration nginx domain-name http-status-code-403

158
推荐指数
11
解决办法
39万
查看次数

Apache VirtualHost 403 Forbidden

我最近尝试用Apache设置测试服务器.该网站必须在域下运行www.mytest.com.我总是得到一个403 Forbidden错误.我在Ubuntu 10.10服务器版上.doc根目录在dir之下/var/www.以下是我的设置:

/ var/www的内容

ls -l /var/www/

total 12
drwxr-xr-x 2 root root 4096 2011-08-04 11:26 mytest.com
-rwxr-xr-x 1 root root 177 2011-07-25 16:10 index.html
Run Code Online (Sandbox Code Playgroud)

服务器上主机文件的内容(IP 192.168.2.5)

cat /etc/hosts

127.0.0.1 localhost 
127.0.1.1 americano
192.168.2.5 americano.mytest.com www.mytest.com

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Run Code Online (Sandbox Code Playgroud)

网站配置

<VirtualHost *>
ServerAdmin admin@mytest.com
ServerName www.mytest.com
ServerAlias mytest.com

DocumentRoot "/var/www/mytest.com"

ErrorLog /var/log/apache2/mytest-error_log
CustomLog /var/log/apache2/mytest-access_log …
Run Code Online (Sandbox Code Playgroud)

linux apache ubuntu virtualhost http-status-code-403

116
推荐指数
4
解决办法
18万
查看次数

WAMP 403 Windows 7上的禁止消息

我在我的Windows 7机器上安装了WAMP 2.1版.当我在浏览器中浏览到localhost时,WAMP服务器页面可见.

但是当我在浏览器中浏览到我的IP时,我收到了消息

403禁止访问:您无权访问此服务器上的/.

有什么建议?

apache wamp wampserver httpd.conf http-status-code-403

100
推荐指数
7
解决办法
23万
查看次数

MVC4 HTTP错误403.14 - 禁止

我已经构建了一个.net4.5 ASP.NET MVC4 Web应用程序,它在本地工作正常(IIS Express和开发服务器)但是一旦我将它部署到我的Web服务器,它就会抛出403错误.我已经在服务器上安装了.Net 4.5RC,甚至尝试了 aspnet_regiis -i 每个人都推荐用于以前版本的MVC/.Net的问题,但它没有帮助.

有任何想法吗?

编辑:有关情况的更多信息.服务器是32位,我有4个其他MVC3应用程序可以正常工作.这只是我的MVC4应用程序无法正常工作.

.net iis asp.net-mvc http-status-code-403 asp.net-mvc-4

88
推荐指数
6
解决办法
10万
查看次数

Python 3 Web Scraping中的HTTP错误403

我试图废弃一个网站进行练习,但我继续得到HTTP错误403(它认为我是一个机器人)?

这是我的代码:

#import requests
import urllib.request
from bs4 import BeautifulSoup
#from urllib import urlopen
import re

webpage = urllib.request.urlopen('http://www.cmegroup.com/trading/products/#sortField=oi&sortAsc=false&venues=3&page=1&cleared=1&group=1').read
findrows = re.compile('<tr class="- banding(?:On|Off)>(.*?)</tr>')
findlink = re.compile('<a href =">(.*)</a>')

row_array = re.findall(findrows, webpage)
links = re.finall(findlink, webpate)

print(len(row_array))

iterator = []
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

 File "C:\Python33\lib\urllib\request.py", line 160, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python33\lib\urllib\request.py", line 479, in open
    response = meth(req, response)
  File "C:\Python33\lib\urllib\request.py", line 591, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python33\lib\urllib\request.py", line 517, in error …
Run Code Online (Sandbox Code Playgroud)

python http http-status-code-403 web

79
推荐指数
5
解决办法
11万
查看次数

模拟403错误页面

我知道你可以发送一个标题告诉浏览器这个页面是禁止的:

header('HTTP/1.0 403 Forbidden');
Run Code Online (Sandbox Code Playgroud)

但是,如何才能显示在服务器上为此类错误创建的自定义错误页面?

默认情况下,只是发送标题会显示一个白页,但我记得有一段时间后,您可以使用客户错误页面.有人知道吗?

php header http-status-code-403

56
推荐指数
6
解决办法
12万
查看次数

无法使用Elmah MVC访问生产服务器上的/ elmah?

我安装了elmah.mvc nuget软件包并保留了默认配置,即设置发送电子邮件并将其插入SQL数据库.

在我使用Visual Studio主机的本地计算机上,我可以打开我的应用程序并访问/ elmah罚款以查看错误报告.但是,当我尝试访问/ elmah生产时,我得到两个错误,首先我收到403 access is denied服务器错误.然后在我的电子邮件中(来自elmah)我得到:

System.Web.HttpException: Server cannot set status after HTTP headers have been sent.
Run Code Online (Sandbox Code Playgroud)

任何人都知道这里发生了什么以及如何解决?谢谢.

到目前为止,我尝试了以下答案的建议:

<system.webServer>

<handlers>
  <add name="elmah" verb="GET" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
</handlers>
Run Code Online (Sandbox Code Playgroud)

并在 <system.web>

<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
Run Code Online (Sandbox Code Playgroud)

我尝试将路径设置为两者elmah.axd并且简单~/elmah.所有仍然给出相同的错误,仍然在本地工作,但不在生产中.

编辑:它实际上也适用于我远程进入服务器并通过浏览器访问它(不使用localhost,但实际的站点地址).那么我没有什么许可?好像它是在服务器级别.

c# asp.net-mvc elmah http-status-code-403

55
推荐指数
1
解决办法
1万
查看次数