| |||||||
| المدوّنات | البحث | مشاركات اليوم | اجعل كافة المشاركات مقروءة |
|
| | LinkBack | أدوات الموضوع |
| |||||
| (سؤال) طريقة جعل ملفاتي في السيرفر ما تتجزأ في برامج اكمال التحميل عندي الاعضاء ذبحوني من التحميل بطريقة خاطئة وهي تجزيء ملف البرنامج مثلاً الى 10 اجزاء وهالشيء يسبب ضغط كبير على السيرفر لأن كل جزء يعتبر كونكشن جديد. كيف اقدر اخلي العضو فقط يحمل الملف من الموقع كملف واحد ولا يقبل التجزئة او تقسيمه في برامج اكمال التحميل وما شابهها؟ كلي أمل بكم خبراء سوالف الكرام. | |||||
|
| |||||
|
فعلا حتى انا محتاج الطريقة اظن ان الفكرة انه ماتخلي الزائر يفتح اتصال جديد يعني بس اتصال واحد لزائر واحد فقط بس طريقة التطبيق ماعرفها ياريت احد يساعدنا فيها ويكون مشكور
__________________ صفحة الإعلانات في مخزن من هنا | |||||
|
| |||||
|
لقيت شي ممكن يفيدنا With the Module "mod_throttle" you can vary the settings for each Virtual hosts. For example, you need to limit the data usage for a particular domain for predefined number of days. ------------------------------------ Edit your /etc/httpd/conf/httpd.conf and locate the virtualhost entry for the site you wish to throttle. Just BEFORE the </VirtualHost> entry, insert: <IfModule mod_throttle.c> ThrottlePolicy Volume 10G 30d </IfModule> <Location /throttle-me> SetHandler throttle-me </Location> The ThrottlePolicy line is the key. The first number is the amount of data and acceptable letters are G, M and K. The second number is the period and acceptable letters are m, w, d, h, and s. Then restart Apache (service httpd restart) Now you can go to: http://throttleddomain.com(the domain given to throttle)/throttle-me And see the status of the throttle. --------------------------------- More details regarding mod_throttle can be found on the link below. --------------------------------- Installing Mod_Throttle on cPanel - cPanel Tutorials --------------------------------- Hope your query is cleared. Please get back to us if you need any further clarifications. هذا المودل الأول Apache web server, I assume? There's always LimitIPConn (mod_limitipconn.c), which limits the number of simultaneous connections per IP address, but you want to be careful to not break normal requests for images by web site visitors وهذا الثاني ياريت احد يشرح لنا وش الافضل للي نبغاه
__________________ صفحة الإعلانات في مخزن من هنا | |||||
|
| |||||
|
العمليه سهله جدا تستطيع عمل ذلك بعدة طرق لكن الاسهل هو عن طريق NetFilter و هو تحديد عدد الاتصال لكل مستخدم عن طريق الاي بي تقدر تعدل فيه على كيفك مثلا تخليه لكل اي بي صلاحيه يفتح اتصالين Connections في iptables اضف هذا الامر كود: iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent \ --set iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent \ --update --seconds 600 --hitcount 2 -j DROP و ايضا في الامر السابق يسمح لكل مستخدم بفتح عدد 2 كونكشن بنفس الدقيقه ____________ او عن طريق mod_evasive بالكود التالي كود: #include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "plugin.h"
#include "inet_ntop_cache.h"
/**
* mod_evasive
*
* we indent to implement all features the mod_evasive from apache has
*
* - limit of connections per IP
* - provide a list of block-listed ip/networks (no access)
* - provide a white-list of ips/network which is not affected by the limit
* (hmm, conditionals might be enough)
* - provide a bandwidth limiter per IP
*
* started by:
* - w1zzard@techpowerup.com
*/
typedef struct {
int max_conns;
} plugin_config;
typedef struct {
PLUGIN_DATA;
plugin_config **config_storage;
plugin_config conf;
} plugin_data;
INIT_FUNC(mod_evasive_init) {
plugin_data *p;
p = calloc(1, sizeof(*p));
return p;
}
FREE_FUNC(mod_evasive_free) {
plugin_data *p = p_d;
UNUSED(srv);
if (!p) return HANDLER_GO_ON;
if (p->config_storage) {
size_t i;
for (i = 0; i < srv->config_context->used; i++) {
plugin_config *s = p->config_storage[i];
free(s);
}
free(p->config_storage);
}
free(p);
return HANDLER_GO_ON;
}
SETDEFAULTS_FUNC(mod_evasive_set_defaults) {
plugin_data *p = p_d;
size_t i = 0;
config_values_t cv[] = {
{ "evasive.max-conns-per-ip", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION },
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
};
p->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *));
for (i = 0; i < srv->config_context->used; i++) {
plugin_config *s;
s = calloc(1, sizeof(plugin_config));
s->max_conns = 0;
cv[0].destination = &(s->max_conns);
p->config_storage[i] = s;
if (0 != config_insert_values_global(srv, ((data_config *)srv->config_context->data[i])->value, cv)) {
return HANDLER_ERROR;
}
}
return HANDLER_GO_ON;
}
#define PATCH(x) \
p->conf.x = s->x;
static int mod_evasive_patch_connection(server *srv, connection *con, plugin_data *p) {
size_t i, j;
plugin_config *s = p->config_storage[0];
PATCH(max_conns);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
data_config *dc = (data_config *)srv->config_context->data[i];
s = p->config_storage[i];
/* condition didn't match */
if (!config_check_cond(srv, con, dc)) continue;
/* merge config */
for (j = 0; j < dc->value->used; j++) {
data_unset *du = dc->value->data[j];
if (buffer_is_equal_string(du->key, CONST_STR_LEN("evasive.max-conns-per-ip"))) {
PATCH(max_conns);
}
}
}
return 0;
}
#undef PATCH
URIHANDLER_FUNC(mod_evasive_uri_handler) {
plugin_data *p = p_d;
size_t conns_by_ip = 0;
size_t j;
if (con->uri.path->used == 0) return HANDLER_GO_ON;
mod_evasive_patch_connection(srv, con, p);
/* no limit set, nothing to block */
if (p->conf.max_conns == 0) return HANDLER_GO_ON;
for (j = 0; j < srv->conns->used; j++) {
connection *c = srv->conns->ptr[j];
if (c->dst_addr.ipv4.sin_addr.s_addr == con->dst_addr.ipv4.sin_addr.s_addr) {
conns_by_ip++;
if (conns_by_ip > p->conf.max_conns) {
log_error_write(srv, __FILE__, __LINE__, "ss",
inet_ntop_cache_get_ip(srv, &(con->dst_addr)),
"turned away. Too many connections.");
con->http_status = 403;
return HANDLER_FINISHED;
}
}
}
return HANDLER_GO_ON;
}
int mod_evasive_plugin_init(plugin *p) {
p->version = LIGHTTPD_VERSION_ID;
p->name = buffer_init_string("evasive");
p->init = mod_evasive_init;
p->set_defaults = mod_evasive_set_defaults;
p->handle_uri_clean = mod_evasive_uri_handler;
p->cleanup = mod_evasive_free;
p->data = NULL;
return 0;
} | |||||
|
| |||||
| اقتباس:
انا افضل استعمال الطريقه الاولى و هي كالتالي ادخل الشل و قم بتحرير ملف iptables عن طريق محرر الملفات المفضل لديك او الموجود في سيرفرك و لنفرض انه Pico اذا سيكون الامر كالتالي كود: pico etc/sysconfig/iptables فقط عدل على الاوامر الي كتبتها لك بالسابق بما يناسبك و اضفهم الى قائمة الاوامر و اضغط Ctrl+X ثم Y ثم Enter و على ما اعتقد يجب عمل رستارت للبايند سيرفس عن طريق الامر التالي كود: /etc/init.d/bind restart سلامتكم | |||||
|
| |||||
|
تسلم عيونك يالغالي ![]() سويت الطريقة وكتبت الكود بهالطريقة (ابيه يكون فقط اتصال واحد في كل تحميل، فهل صح الكود أو لا؟): كود: iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent \ --set iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent \ --update --seconds 600 --hitcount 1 -j DROP اقتباس:
كود: /etc/sysconfig/iptables بعدها كتبت امر الريستارت للبند وكتب لي ايرورر .. ورحت للـ WHM وسويت الريستارت من هناك للـ Bind. طبعاً جربت احمل ملف من الموقع بواسطة برنامج اكمال تحميل وخليته يسوي 16 كونكشن عشان اقطع الشك باليقين .. وللأسف الطريقة ما نفعت يعني فتح 16 كونكشن وجلس يحملهم ![]() انتظر ردك اخوي Amman-DJ لا هنت .. | |||||
|
| |||||
|
للرفع للأهمية لأي من الأخوان خبراء السيرفرات .. السيرفر بعد كتابة الأمر صار يعطي خطأ 500 لما افتح موقعي واللود يرتفع بشكل رهيب كل كم ساعه وما يحلها الا الرويبوت للسيرفر. يا ليت من الأخوان اخباري بطريقة لعمل Undo أو استرجاع او حذف الأمر اللي كتبته فوق. والله يجزاكم حير مقدماً. | |||||
|
![]() |
| أدوات الموضوع | |
| |
المواضيع المتشابهه | ||||
| الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
| سؤال عن برامج التحميل مثل داون مانجر وغيرها | khobar | أخبار الإنترنت والتقنية ومناقشتها | 1 | 14-07-2006 04:06 AM |
| هل يوجد طريقة لمنع إستئناف التحميل من السيرفر ؟ | MaRWaN | قسم تبادل خبرات الاستضافة | 5 | 03-01-2006 12:28 PM |
| سؤال هام عن كيفية منع برامج التحميل أو تحديد التحميل | ماجدة | قسم تبادل خبرات الاستضافة | 4 | 17-09-2005 08:05 PM |
| طريقة حماية السيرفر (( KISS My Firewall )) | البروفسيور | قسم تبادل خبرات الاستضافة | 18 | 31-10-2003 04:49 AM |
| برامج النقاش PHH - CGI لمن يريد التعريب | عبد الرحمن | تطوير الويب | 1 | 19-12-2000 08:54 PM |