我有一个网址,由于某种未知原因而被禁止返回403.我已禁用.htaccess中的mod_security,chmodded文件为0777.URL为
http://www.veepiz.com/afrostar.php?app=help&func=addvideo
当你提交任何想法时,它会发生吗?
这是代码
function PublicAddVideo()
{
if (isset($_POST['submit_addvideo']))
{
require_once("class.phpmailer.php");
//send email tobirthday person
$subject="New AfroStar Video Suggested";
$msg = "Dear Jordah,\n".
"Youtube video: ".$_POST['youtubesle']."\n Star Name: ".$_POST['starnamesle']."\n Country: ".$_POST['countrysle']."\n IP Address: ".getRealIpAddr();
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "localhost"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "support@veepiz.com"; // SMTP username
$mail->Password = "********"; // SMTP password
$mail->From = "support@veepiz.com";
$mail->FromName = "Veepiz"; …Run Code Online (Sandbox Code Playgroud) 当我提交一个带有输入文件的多部分/表单数据表单时,我遇到了一个奇怪的 apache 错误。似乎只有当我上传 70kb 或更大的文件时才会发生。
这是我的 php.ini 设置:
file_uploads = On
upload_max_filesize = 10M
max_execution_time = 90
max_input_time = 90
memory_limit = 196M
post_max_size = 10M
Run Code Online (Sandbox Code Playgroud)
这是 test.php 中的 HTML:
<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="pdfMagazine" />
<input type="submit" value="Save" name="saveMagazine" />
</form>
Run Code Online (Sandbox Code Playgroud)
这是错误:
Forbidden
You don't have permission to access /test.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 Server …Run Code Online (Sandbox Code Playgroud) 我刚刚设置了一个Nginx和unicorn服务器fpr我的rails应用程序.直到现在一切顺利.两台服务器都在启动,我可以通过我的URL访问它们.但我的问题是nginx总是从公共文件夹加载index.html作为起始页面.如果我删除index.html文件,那么请求会导致403 Forbidden错误.当我尝试其他路线时,它会导致404找不到错误.所以我假设nginx和unicorn服务器之间没有连接.也许我错了.试图解决这个问题几个小时但没有成功.如果有人可以帮助我,那将是非常好的.
这是我的配置:
nginx.comfig:
/etc/nginx/conf.d/medinow.conf
upstream unicorn {
server unix:/tmp/unicorn.medinow.sock fail_timeout=0;
}
server {
listen 80 default deferred;
# server_name example.com;
root /var/www/medinow/current/public;
location / {
gzip_static on;
}
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
Run Code Online (Sandbox Code Playgroud)
unicorn.conf.rb:
worker_processes 4
APP_PATH = "/var/www/medinow/current"
working_directory APP_PATH # available …Run Code Online (Sandbox Code Playgroud) 我的django项目出现403错误.
我在错误日志中得到的唯一一行是:
AH01630: client denied by server configuration: /srv/http/www/src/myproject/preprod_wsgi.py
Run Code Online (Sandbox Code Playgroud)
该文件的权限是:
-rwxr-xr-x 1 root root 552 Jul 30 04:24 preprod_wsgi.py
Run Code Online (Sandbox Code Playgroud)
而apache(VERSION:2.4)conf文件包含(除其他外):
LoadModule wsgi_module modules/mod_wsgi.so
<IfModule unixd_module>
User http
Group http
</IfModule>
<Directory />
AllowOverride none
Require all denied
</Directory>
#
# Others
#
Alias /robots.txt /srv/http/www/htdocs/static/robots.txt
Alias /favicon.ico /srv/http/www/htdocs/static/favicon.ico
Alias /media/ /srv/http/www/htdocs/media/
Alias /static/ /srv/http/www/htdocs/static/
<Directory "/srv/http/www/htdocs/static">
Require all granted
</Directory>
<Directory "/srv/http/www/htdocs/media">
Require all granted
</Directory>
<Files "/srv/http/www/src/myproject/preprod_wsgi.py">
Require all granted
</Files>
#
# WSGI
#
WSGIDaemonProcess myproject …Run Code Online (Sandbox Code Playgroud) 我搜索了很多关于这个,但解决方案并没有那么多帮助.我试图在我的FreeBSD上将redmine升级到2.6.5,但我有403错误.
apache错误日志:
[autoindex:error] AH01276:无法提供目录/ usr/local/www/redmine/public /:找不到匹配的DirectoryIndex(无),以及Options指令禁止的服务器生成的目录索引
我的httpd conf:
<VirtualHost example.com:80>
DocumentRoot "/usr/local/www/redmine/public"
ServerName example.com
FastCgiServer /usr/local/www/redmine/public/dispatch.fcgi -idle-timeout 120 -initial-env RAILS_ENV=production -initial-env PATH=/usr/local/bin -processes 2
<Directory "/usr/local/www/redmine/public">
AddHandler fastcgi-script fcgi
Order allow,deny
Allow from all
AllowOverride all
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi
</Directory>
ErrorLog /logs/error.log
</Virtualhost>
Run Code Online (Sandbox Code Playgroud)
我不得不说:如果我在选项中添加+索引我在浏览器中看到文件,所以我觉得预设很好.任何人都可以给我任何暗示?在此先感谢4你的帮助
尝试将图像从服务器上传到服务器我得到:
[ { domain: 'global', reason: 'forbidden', message: 'googlec-storage-object-creator@project-name.iam.gserviceaccount.com 没有 storage.objects.delete 访问bucket-mybucket/mypicture 的权限。 jpg.' }],代码:403,
如果图像名称不同,它就可以工作。版本控制已暂停,并且有一个具有该名称的文件,但它已被删除。
我什至删除了存储桶并重新创建了它,问题仍然存在。
如果文件名与“mypicture.jpg”不同,则完全没有错误
有什么帮助吗?谢谢
buckets bucket http-status-code-403 google-cloud-storage google-cloud-platform
我有一个用 wordpress 构建并上传到 linux 服务器上的网站。它已经运行了很长时间,但是昨天我的网站在加载图像资源时开始给我 403 禁止错误。
但是当我在新选项卡中打开该资源时,它会成功加载。然后我回到我的网站,刷新它,现在重新加载那个特定的图像。
我不知道发生了什么。我需要帮助。
这是MyProj/urls.py 的内容:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('general.urls')), # Main app
]
handler403 = 'general.views.handler403'
handler404 = 'general.views.handler403'
Run Code Online (Sandbox Code Playgroud)
如您所见,两个处理程序都指向同一个视图,而我最需要的第一个视图不起作用!例如,其他用户的数据/obj/12显示默认浏览器403页面:
[22/Jan/2019 08:39:14] "GET /obj/12 HTTP/1.1" 403 0
但第二个运行良好并显示正确的页面(当尝试访问一些不存在的数据时/obj/768)。为什么以及如何解决?
调试模式关闭。我的 Django 版本是 2.0.6
更新。
handler403.py文件的内容:
from django.shortcuts import render_to_response
def handler403(request, *args, **argv):
print('Handler 403 was called!')
u = request.user
params = {
'user': u,
}
response = render_to_response('403.html', params)
response.status_code = 403
return response …Run Code Online (Sandbox Code Playgroud) 尝试使用 Google Apps 脚本从网站获取数据,并将其直接放入电子表格中。fetch 似乎不起作用,而 Python requests 的等效项工作得很好。
Python代码:
page = requests.get("someurl?as_data_structure", headers={'user-agent':'testagent'})
Run Code Online (Sandbox Code Playgroud)
气体代码:
var page = UrlFetchApp.fetch("someurl?as_data_structure", headers={'user-agent':'testagent'});
Run Code Online (Sandbox Code Playgroud)
唯一需要的标头是用户代理,如果我没有包含标头,我从 GAS 代码中得到的错误就是我通常从 Python 代码中得到的错误。我是 js 新手,但据我所知这是正确的方法..?
编辑:现在标题位于正确的位置,但问题仍然存在,与以前的错误完全相同。
var options = {"headers": {"User-Agent": "testagent"}};
var page = UrlFetchApp.fetch("someurl?as_data_structure", options);
Run Code Online (Sandbox Code Playgroud) user-agent http-headers urlfetch http-status-code-403 google-apps-script
我正在尝试从该网站抓取信息,但不断收到状态代码:403,因此尝试使用 header 但收到TypeError:request() 获得意外的关键字参数“header”
代码:
import requests
head = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0'}
url = "https://www.accuweather.com/en/bd/dhaka/28143/current-weather/28143"
pageObj = requests.get(url, header = head)
print("Status code: " + str(pageObj.status_code)) # *for testing purpose*
Run Code Online (Sandbox Code Playgroud)
错误:
Traceback (most recent call last):
File "F:/Python/PyCharm Community Edition 2019.2.3/Workshop/WEB_SCRAPING/test2.py", line 6, in <module>
pageObj = requests.get(url, header = head)
File "F:\Python\PyCharm Community Edition 2019.2.3\Workshop\WEB_SCRAPING\venv\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "F:\Python\PyCharm …Run Code Online (Sandbox Code Playgroud)