PDA

View Full Version : حرفه ای: دلیل این ارور چیه؟ You don't have permission to access /main/slidshow/slids/notinweb on this server



idocsidocs
پنج شنبه 16 شهریور 1391, 12:08 عصر
یه سایت طراحی کردم که مرتب این ارور نمایش داده می شه:

بنظرتون مشکلش چیه؟ بیشتر وقتی ار ایجکس استفاده می کنم این ارور ایجاد می شه ولی بعضی مواقع توی درخواستهای غیر ایجکسی هم این مشکل ایجادمی شه.


Forbidden

You don't have permission to access /main/slidshow/slids/notinweb on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


Apache/2 Server at www.site.ir Port 80

محتویات فایل htaccess



#To privent from file listing in pages that dont have index file
IndexIgnore *

#To add charset
AddDefaultCharset utf-8

<limit put>

order deny,allow

deny from all

</limit>
#privent from FSOCKOPEN


# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>

# disable directory browsing
Options All -Indexes

# STRONG HTACCESS PROTECTION</code>
<Files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</Files>

#<Files .htaccess>
#order allow,deny
#deny from all
#</Files>

##############################
# BEGIN Compress text files
<ifModule mod_deflate.c>
<filesMatch "\.(css|js|php|x?html?)$">
SetOutputFilter DEFLATE
</filesMatch>
</ifModule>
# END Compress text files

# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
ExpiresByType image/png "access plus 2592000 seconds"
ExpiresByType image/gif "access plus 2592000 seconds"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 216000 seconds"
ExpiresByType application/javascript "access plus 216000 seconds"
ExpiresByType application/x-javascript "access plus 216000 seconds"
#ExpiresByType text/html "access plus 600 seconds"
ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>
# END Expire headers

# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|bmp|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
<filesMatch "\.(x?html?)$">
Header set Cache-Control "max-age=600, private, must-revalidate"
</filesMatch>
</ifModule>
# END Cache-Control Headers

# BEGIN Turn ETags Off
<ifModule mod_headers.c>
Header unset ETag
</ifModule>
FileETag None
# END Turn ETags Off

# BEGIN Remove Last-Modified Header
<ifModule mod_headers.c>
Header unset Last-Modified
</ifModule>
# END Remove Last-Modified Header

##############################
#AddType application/x-httpd-php .asp .py .pl
#page not found
ErrorDocument 404 /page/p404
#Access forbidden:
ErrorDocument 403 /page/p403
#Server error
ErrorDocument 500 /page/p500

RewriteEngine On
Options +FollowSymLinks
RewriteBase /

# yes-www
#RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
#RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

RewriteRule ^folder1/.*$ - [L]
RewriteRule ^folder2/.*$ - [L]

RewriteRule ^sitemap.xml$ service/sitemap.php [NC,L]
RewriteRule ^robots.txt$ service/robots.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]

#to privent from <script> tags
#RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
#RewriteRule ^(.*)$ index.php [F,L]

#################################################
#To privent from load your pics in other wweb sites
#RewriteCond %{HTTP_REFERER} !^$
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
#RewriteRule \.(gif|jpg|jpeg|png|bmp|swf|flv)$ - [F]

#To show your pic in the sites which load your sites
#RewriteCond %{HTTP_REFERER} !^$
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
#RewriteRule \.(gif|jpg|jpeg|png|bmp|swf|flv)$ http://www.mydomain.com/badimage.gif [R,L]
#################################################

idocsidocs
یک شنبه 26 شهریور 1391, 22:38 عصر
با توجه به اینکه این بحث مهم بود، برای Unique عزیز یه پیام خصوصی فرستادم و این جواب رو گرفتم:


سلام

احتمالا دوستان به این خاطر نظری نداده اند چون این خطا به خیلی مطالب بستگی داره ، من تجربیات خودم را میگم خدمتتون :

1 - اگه apache به دایرکتوری مربوط یا wwwroot دسترسی مورد نیاز را نداشته باشه یا مثلا فایل خاصی دسترسی ازش صلب شده باشه !
2 - اگه شما مستفیما صفحه ای را صدا نمیزنید و DirectoryIndex برای اون پوشه تعین نشده
3 - با اجرای دستور chmod +x برای فایل مورد نظر (معمولا cgi) ها
4 - بعضی وقت ها اجازه استفاده از فایل htaccerss. توی apache کاملا disabled میشه و شما به خطای 403 میخورین !
5 - میشه مشکل دسترسی به دایرکتوری را با کد زیر حل کرد :
<Directory "/directory/path">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all</Directory>

با چک کردن فایل error.logs توی فولدر مربوط به apache میشه اطلاعات بیشتری به دست آورد.

به صورت قاطع مشکل از دسترسی هستش و باید کمی با دقت و حوصله بررسی کنید.

idocsidocs
یک شنبه 26 شهریور 1391, 22:41 عصر
سوالی که الان دارم اینه که با توجه به توضیحات Unique عزیز و توضیحاتی که توی این صفحه (http://www.cyberciti.biz/faq/apache-403-forbidden-error-and-solution/) دیدم ظاهرا مشکل بخاطر Deny from all هست و با حذف اون و استفاده از Allow from all مشکل برطرف می شه.

دلیل این موضوع چیه؟

سوال دیگه اینکه کدهای زیر دقیقا به آپاچی چه دستوری می دن؟


<Directory "/directory/path">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all</Directory>

Unique
دوشنبه 27 شهریور 1391, 22:18 عصر
راستش من خیلی در زمینه تنظیمات apache صاحب تجربه نیستم و بتره شما این سوالات را از یک نفر که کاملا با تنظیمات apache آشنایی داره بپرسین اما معلومات اینجانب اینه :

در مورد بخش Options که حاوی Indexes هست (میگه فایل ها و دایرکتوری ها را Index کنه) ، FollowSymLinks (میگه اجازه بده apache symbolic link ها را دنبال کنه ! symbolic link ها یه چیزی هستند که مثلا شما میتونید یک path غیر واقعی را به یک path واقعی یا hard link تبدیل کنید، برای اطلاعات بیشتر اینجا را بخونید (http://www.maxi-pedia.com/FollowSymLinks). +ExecCGI هم میگه اجازه اجرای cgi رو بده و چیز خاصی نیست !

در قسمت AllowOverride شما AuthConfig را دارین که اجازه میده از authentication directives ها استفاده بشه ! FileInfo هم بهتون اجازه میده document types i ها را کنترل کنید !
Order که بعدش allow,deny اومده میگه directive های allow را قبل از deny ها پردازش کن در واقع ترتیب directive ها را تعین میکنه
Allow from all هم میگه به همه اجازه بده فایل های این دایرکتوری را درخواست کنند.

idocsidocs
سه شنبه 28 شهریور 1391, 00:19 صبح
Allow from all هم میگه به همه اجازه بده فایل های این دایرکتوری را درخواست کنند.
اگر بجای Allow from all از deny from all استفاده کنیم، چه اتفاقی میافته؟

Unique
سه شنبه 28 شهریور 1391, 23:20 عصر
خوب دیگه دسترسی نمیده به کاربران !

idocsidocs
سه شنبه 28 شهریور 1391, 23:41 عصر
خوب دیگه دسترسی نمیده به کاربران !


منکه همیشه از این کد استفاده می کنم، چطور کاربها می تونن دسترسی داشته باشن؟ ! :متفکر: