尝试在vhost下打开页面时,我获得了403访问权限,其中文档根位于与apache所在位置不同的驱动器上.我使用apachefriends发布安装.这是我的httpd-vhosts.conf文件:
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName foo.localhost
DocumentRoot "C:/xampp/htdocs/foo/public"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName bar.localhost
DocumentRoot "F:/bar/public"
</VirtualHost>
在我的浏览器中打开bar.localhost时,Apache正在给我403 Access Forbidden.我尝试设置了许多不同的访问权限,甚至是对所有人的完全权利,但我尝试过没有任何帮助.
编辑:谢谢!为了将来参考,请在其中添加"选项索引"以显示目录索引.
我刚刚安装了Mac OS X Yosemite.我将Apache和chmodded"users/user/Sites"配置为755.当我点击localhost时,我收到403 Forbidden "You don't have permission to access / on this server".我添加到主机文件的任何其他站点都会出现同样的情况.
我尝试按照这篇文章的帮助配置用户目录.这个MacRumors线程的人知道有一个Apache问题,但没有提供很多建议.
我的目录权限如下所示
drwxr-xr-x 29 root wheel 1054 Aug 11 07:30 /
drwxr-xr-x 6 root admin 204 Aug 11 07:29 /Users/
drwxr-xr-x+ 26 zachshallbetter staff 884 Aug 11 11:57 /Users/zachshallbetter/
0: group:everyone deny delete
drwxr-xr-x 5 zachshallbetter staff 170 Aug 11 10:16 /Users/zachshallbetter/Sites
Run Code Online (Sandbox Code Playgroud)
有人可以提供任何建议或帮助吗?以下是我的主机和httpd.conf文件的链接以及错误日志以供参考.
有办法解决以下问题吗?
httperror_seek_wrapper: HTTP Error 403: request disallowed by robots.txt
Run Code Online (Sandbox Code Playgroud)
是唯一的方法来联系网站所有者(barnesandnoble.com)..我正在建立一个网站,将带来更多的销售,不知道为什么他们会拒绝在一定深度访问.
我在Python2.6上使用了mechanize和BeautifulSoup.
希望能够解决问题
python screen-scraping mechanize beautifulsoup http-status-code-403
我有Nginx设置并正确显示测试页面.如果我尝试更改根路径,即使所有权限都相同,我也会收到403 Forbidden错误.此外,nginx用户存在.
nginx.conf:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
index index.html index.htm;
server {
listen 80;
server_name localhost;
root /var/www/html; #changed from the default /usr/share/nginx/html
}
}
Run Code Online (Sandbox Code Playgroud)
namei -om /usr/share/nginx/html/index.html
f: /usr/share/nginx/html/index.html
dr-xr-xr-x root root /
drwxr-xr-x root root usr
drwxr-xr-x root root share
drwxr-xr-x root root nginx
drwxr-xr-x root root html
-rw-r--r-- root root index.html
Run Code Online (Sandbox Code Playgroud)
namei -om /var/www/html/index.html
f: /var/www/html/index.html
dr-xr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root …Run Code Online (Sandbox Code Playgroud) 我正在编写一个小型Java程序来获取给定Google搜索词的结果数量.出于某种原因,在Java中我得到403 Forbidden但我在Web浏览器中获得了正确的结果.码:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
public class DataGetter {
public static void main(String[] args) throws IOException {
getResultAmount("test");
}
private static int getResultAmount(String query) throws IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(new URL("https://www.google.com/search?q=" + query).openConnection()
.getInputStream()));
String line;
String src = "";
while ((line = r.readLine()) != null) {
src += line;
}
System.out.println(src);
return 1;
}
}
Run Code Online (Sandbox Code Playgroud)
而错误:
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: https://www.google.com/search?q=test
at …Run Code Online (Sandbox Code Playgroud) 我在桌面上运行ubuntu 13.04 64bit,我安装了Apache2,MySQL和PHP等.
我想让我的网络根目录/home/afflicto/public_html而不是/var/www.于是我就跟着去了本指南:
http://www.maketecheasier.com/install-and-configure-apache-in-ubuntu/2011/03/09
(我所做的一切,从"配置不同的网站"),因为我喜欢解决更多.
这就是我所做的:
安装Apache2,MySQL等..
复制/etc/apache2/sites-avaliable/default到/etc/apache2/sites-available/afflicto.然后编辑它,它现在看起来如下:
在/ etc/apache2的/网站可用/ afflicto
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/afflicto/public_html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/afflicto/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel …Run Code Online (Sandbox Code Playgroud) 当我从具有403响应的URL获取数据时
is = conn.getInputStream();
Run Code Online (Sandbox Code Playgroud)
它抛出IOException,我无法获取响应数据.
但是当我使用firefox并直接访问该URL时,ResponseCode仍然是403,但我可以获得html内容
我尝试使用Python的urllib获取维基百科文章:
f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes")
s = f.read()
f.close()
Run Code Online (Sandbox Code Playgroud)
然而,而不是HTML页面,我得到以下响应:错误 - 维基媒体基金会:
Request: GET http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes, from 192.35.17.11 via knsq1.knams.wikimedia.org (squid/2.6.STABLE21) to ()
Error: ERR_ACCESS_DENIED, errno [No Error] at Tue, 23 Sep 2008 09:09:08 GMT
Run Code Online (Sandbox Code Playgroud)
维基百科似乎阻止了不是来自标准浏览器的请求.
有谁知道如何解决这个问题?
我正在点击偶尔会抛出HTTP 403错误的API,响应机构可以以json的形式提供一些额外的信息,但是对于我的生活,我似乎无法从Alamofire中获取信息响应对象.如果我通过chrome访问API,我会在开发人员工具中看到这些信息.这是我的代码:
Alamofire.request(mutableURLRequest).validate().responseJSON() {
(response) in
switch response.result {
case .Success(let data):
if let jsonResult = data as? NSDictionary {
completion(jsonResult, error: nil)
} else if let jsonArray = data as? NSArray {
let jsonResult = ["array" : jsonArray]
completion(jsonResult, error: nil)
}
case .Failure(let error):
//error tells me 403
//response.result.data can't be cast to NSDictionary or NSArray like
//the successful cases, how do I get the response body?
}
Run Code Online (Sandbox Code Playgroud)
我几乎查询了附加到响应的每个对象,但是在HTTP错误的情况下它似乎没有给我回复响应主体.有没有解决方法或我在这里缺少的东西?
当我使用以下Python代码向我的Django网站发送POST请求时,我得到403:Forbidden错误.
url = 'http://www.sub.domain.com/'
values = { 'var': 'test' }
try:
data = urllib.urlencode(values, doseq=True)
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
except:
the_page = sys.exc_info()
raise
Run Code Online (Sandbox Code Playgroud)
当我打开任何其他网站时,它正常工作.domain.com也是Django网站,也可以正常使用.我认为,这是Django配置问题,任何人都可以告诉我应该怎么做才能提供对我脚本的访问权限?