我在Ubuntu10.10上设置了nginx 0.7.67以及php-cli.我正在尝试运行基于前端控制器的PHP框架,但除index.php之外的所有页面都会出现403错误.
例如:
我的/ etc/nginx/sites-enabled/default如下
server {
listen 80;
server_name mysite.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
index index.php index.html;
root /full/path/to/public_html;
location ~* \.(js|css|png|jpg|jpeg|gif|ico|html)$ {
expires max;
}
location ~ index.php {
include /etc/nginx/fastcgi_params;
keepalive_timeout 0;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
}
Run Code Online (Sandbox Code Playgroud)
有关如何解决上述问题的任何建议?
PS:这是错误日志中的条目
2010/10/14 19:56:15 [error] 3284#0: *1 open() "/full/path/to/public_html/styles/style.css"
failed (13: Permission denied), client: 127.0.0.2, server: quickstart.local,
request: "GET /styles/style.css HTTP/1.1", host: "mysite"
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的网站上展示 AdSense 广告,但由于某种原因它们没有加载。我几天前添加了广告,因为我听说它们可能需要一段时间才能显示,但直到现在还没有变化。
在“检查”中,当网站应该加载广告时,我可以看到以下错误显示。
加载资源失败:服务器响应状态为 403(禁止)
我从 5 年开始运行这个 AdSense 帐户,在其他网站上使用相同的广告代码。这可能是什么问题,如何解决?
我已经安装了Nginx服务器并配置了所有需要的东西,但是目前我遇到了403 forbidden错误的错误.日志说:
2010/12/28 17:38:59 [error] 28664#0: *27 directory index of "/home/appuser/test_app" is forbidden, client: xxx.xxx.xxx.xxx, server: localhost, request: "GET / HTTP/1.1", host: "xxx.xxx.xxx.xxx"
Run Code Online (Sandbox Code Playgroud)
我的配置:
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.2;
passenger_ruby /usr/bin/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
root /home/appuser/test_app;
passenger_enabled on;
}
}
Run Code Online (Sandbox Code Playgroud)
有解决方案吗
我们有一个工具可以检查给定的URL是否是实时URL.如果给定的网址是实时的,我们软件的另一部分可以屏蔽其中的内容.
这是我检查网址是否有效的代码
public static bool IsLiveUrl(string url)
{
HttpWebRequest webRequest = WebRequest.Create(url) as HttpWebRequest;
webRequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5";
webRequest.CookieContainer = new CookieContainer();
WebResponse webResponse;
try
{
webResponse = webRequest.GetResponse();
}
catch (WebException e)
{
return false;
}
catch (Exception ex)
{
return false;
}
return true;
}
Run Code Online (Sandbox Code Playgroud)
这段代码完美无缺,但是对于在apache上托管的特定站点,我收到了一个带有以下消息的Web异常."远程服务器返回错误:(403)Forbidden"在进一步检查时,我在WebException对象中找到了以下详细信息
Status ="ProtocolError"StatusDescription ="不良行为"
这是请求标题"User-Agent:Mozilla/5.0(Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6)Gecko/20060728 Firefox/1.5主机:scenicspares.co.uk连接:Keep-Alive "
这是响应标题"Keep-Alive:timeout = 4,max = 512 Connection:Keep-Alive Transfer-Encoding:chunked Content-Type:text/html Date:Thu,13 Jan 2011 10:29:36 …
c# screen-scraping httpwebrequest httpwebresponse http-status-code-403
我有这样的代码:
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(server);
try {
JSONObject params = new JSONObject();
params.put("email", email);
StringEntity entity = new StringEntity(params.toString(), "UTF-8");
httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
httpPost.setEntity(entity);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = httpClient.execute(httpPost, responseHandler);
JSONObject response = new JSONObject(responseBody);
fetchUserData(response);
saveUserInfo();
return true;
} catch (ClientProtocolException e) {
Log.d("Client protocol exception", e.toString());
return false;
} catch (IOException e) {
Log.d`enter code here`("IOEXception", e.toString());
return false;
} catch (JSONException e) {
Log.d("JSON exception", e.toString());
return false; …Run Code Online (Sandbox Code Playgroud) 我在整个学期都在使用这台服务器并且没有更改任何配置选项 - 我几周前创建的目录/文件仍然可以访问,但是任何新目录,甚至是旧工作目录的完全重复都不让我访问它们 - 获取错误"Options指令禁止的目录索引".是什么造成的?
这是我的帖子中关于使用Google Calendar API和OAuth2时出现401错误的信息,可以在此处找到
这包含导致我下一个问题的帐户设置的详细信息,因此我不会在此主题中重复自己.
好的,所以当我调用以下代码来更新Calendar事件时,我得到403禁止错误.
for (Event event : events.getItems())
{
event.setSummary("XXX" + event.getSummary());
Event updatedEvent = calendar.events().update(CALENDAR_ID, event.getId(), event).execute();
}
Run Code Online (Sandbox Code Playgroud)
这是返回的错误消息:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
"message" : "Forbidden"
} ],
"message" : "Forbidden"
}
Run Code Online (Sandbox Code Playgroud)
我试过了什么?好吧,我已经重新阅读了关于服务帐户的(相当差的)Google文档,重新检查了我的API控制台帐户设置,尝试更改构建凭据的代码(这会导致其他错误,因此在我之前的帖子中是回归) .
简而言之,没有任何作用,那么我有什么明显的遗漏吗?
我试图从ajax请求访问驻留在S3中的html文件,我收到403错误.
我在线阅读AWS,如果我这样做,我需要设置AWS CORS规则来修复403错误.
但是,我已经尝试了两天而且没有任何运气.这是我的CORS配置:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<ExposeHeader>XMLHttpRequest</ExposeHeader>
<AllowedHeader>x-csrftoken</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Run Code Online (Sandbox Code Playgroud)
我的HTTP请求如下:
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Access-Control-Request-He... x-csrftoken
Access-Control-Request-Me... GET
Connection keep-alive
Host xxxxxxxxx.cloudfront.net
Origin http://localhost:8000
User-Agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:18.0) Gecko/20100101 Firefox/18.0
Run Code Online (Sandbox Code Playgroud)
谁能帮我看看我错过了什么?
谢谢!
嗨,我使用locustio(python)来测试webapp(django)上的负载.当我尝试测试它时,我总是遇到403错误的挑战.他是代码
from locust import HttpLocust, TaskSet
def index(l):
l.client.get("/")
def login(l):
l.client.post("/login/", {"username":"an@id.com", "password":"education")
def upload(l):
l.client.get("/upload-image/")
def home(l):
l.client.get("/home/")
def settings(l):
l.client.get("/settings/")
def logout(l):
l.client.get("/logout/")
class UserBehavior(TaskSet):
tasks = {index:1, upload:1, home:1, settings:1, logout:1}
def on_start(self):
login(self)
class WebsiteUser(HttpLocust):
task_set = UserBehavior
min_wait=5000
max_wait=9000Run Code Online (Sandbox Code Playgroud)
我正在尝试使用选项中的"auth"连接到API.目前它看起来像这样:
var options = {
hostname: '<name of site>',
port: 443,
path: '<path>',
auth:'Bearer <Token>',
method: 'GET'
};
Run Code Online (Sandbox Code Playgroud)
但是,如果我执行请求,我会获得状态代码403.当我在浏览器中放入以下URL时,它可以工作:
https://<Host Name+ Path>?authorization=Bearer%20<Token>
Run Code Online (Sandbox Code Playgroud)
我已经尝试将auth更改为Authorization=Bearer <Token>,Authorisation:Bearer <Token>但它没有改变任何东西.
我可能只是建立授权部分未正确,但找不到任何信息如何auth工作
提前致谢