一:爱人就是爱人,只要去爱,不要拿来比较。不要老说别人的老公如何如何好,别数落他没出息,你是他最亲密的人,你还这么说他,好象不太应该,对大多数男人来说,赞赏和鼓励比辱骂更能让他有奋斗的力量。何况,爱他还忍心伤害他吗?爱他一定要尊重他,再生气也不可以出口伤人,言语的伤口有时一生都在流血的。身体的伤害很容易治愈,精神的伤害后果是可怕的。
二:不可以整天追问对方爱不爱你。他若真爱你,你不必问;他若不爱你,他已做了你的丈夫,难道他会对自己的妻子明确地承认吗?除非他不想要这段婚姻了。他对你的爱,用心去体会就品味出来了。爱是做出来的,不是说出来的。老挂在口头上不落到实际的爱太苍白无力,婚姻是现实的,生活是现实的,风花雪月的恋爱,不是真实的生活。婚姻是从柴米油盐中感受爱的。
三:不要摆脸色给对方看,一个生气的女人是很丑陋的。他工作已有许多压力,没有义务回家还要看你的脸色哄你开心。对方性格上会有缺点,生活细节会与你不同,令你不满意,但他怎么可能是完美的,在你面前,他要放下面具,做回自己,做个普通人。宽容是做人和对待婚姻应有的态度。
四:男人对自己的尊严看得比什么都重要,不管在私下他有多么宠爱你,多么怕你。在人前一定要给足对方面子,让他做天不怕地不怕老婆更不怕的他口中的顶天立地的男子汉,他应该不大会喜欢朋友们开玩笑取笑他怕老婆。除非他有足够的强大后盾和高高在上的身份,可是,我们大多是普通人呀。
五:男人大多喜欢吹牛,你别戳破他的这个小把戏。他们这么样可以让自己得到一点力量,找到一点自信,好继续人生征程下面的拼搏。虚拟的成就感能让他心情明朗起来不好吗?没人喜欢自己一无所是。和妻子在一起,***是身体的放纵,谈话是心灵的放纵,只要爱人得到快乐,轻松一点装傻附合他一下不是很好吗?
六:男人骨子里全都喜欢美女,看到美女会目不转睛或回头行注目礼,你别认为他不爱你,也别认为他好色,爱看美女是男人的本能,与品格无关。何况,爱美知心人皆有之。你难道没偷看过帅哥吗?
七:不要太虚荣,不要太功利。物质的追求是无止境的,你是活自己,不是活给别人看的,鞋子合不合脚只有自个知道,舒服最重要,其它的都是装饰,是虚设。何况俗话说:千金易得,有情郎难寻。真爱无价,情义无价。
八:男人为何喜欢温柔的女人,因为他们内心很脆弱,不象外表般坚强,他们需要妻子的柔情似水,柔声细语,轻怜蜜爱。只要你有温雅如兰的外表和气质,有吐气如兰的声音,有含情脉脉的眼波,他们很容易化百炼钢为绕指柔的,温瑞安有本书叫《温柔一刀》,温柔,可以杀死一个男人的,对于男人,那是致命的诱惑。
九:家庭永远是第一。我们固然要对工作负责,要有职业道德,要从工作中得到乐趣,但不要做工作的奴隶,我们工作是为了更快乐地和家人在一起,享受生活,享受生命很重要。
十:爱人的父母就是自己的父母。将心比心,爱屋及屋,老吾老以及人之老,只要内心深处真正感到这就是我自己的父母,心理上对老人依恋亲密,老人回感受到这份真心的。何况,人老了很象孩子,只要象哄孩子般哄老人开心就好了。我们自己也有老的一天。
IP、网关设置在/etc/network/interfaces
DNS设置在/etc/resolv.conf
更简单的方法:apt-get install etherconf
dpkg-reconfigur etherconf
apache修改httpd.conf内的MaxClients
<?php
/* Version 0.9, 6th April 2003 - Simon Willison ( http://simon.incutio.com/ )
Manual: http://scrīpts.incutio.com/httpclient/
*/
class HttpClient {
// Request vars
var $host;
var $port;
var $path;
var $method;
var $postdata = '';
var $cookies = array();
var $referer;
var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*';
var $accept_encoding = 'gzip';
var $accept_language = 'en-us';
var $user_agent = 'Incutio HttpClient v0.9';
// Options
var $timeout = 20;
var $use_gzip = true;
var $persist_cookies = true; // If true, received cookies are placed in the $this->cookies array ready for the next request
// Note: This currently ignores the cookie path (and time) completely. Time is not important,
// but path could possibly lead to security problems.
var $persist_referers = true; // For each request, sends path of last request as referer
var $debug = false;
var $handle_redirects = true; // Auaomtically redirect if Location or URI header is found
var $max_redirects = 5;
var $headers_only = false; // If true, stops receiving once headers have been read.
// Basic authorization variables
var $username;
var $password;
// Response vars
var $status;
var $headers = array();
var $content = '';
var $errormsg;
// Tracker variables
var $redirect_count = 0;
var $cookie_host = '';
function HttpClient($host, $port=80) {
$this->host = $host;
$this->port = $port;
}
function get($path, $data = false) {
$this->path = $path;
$this->method = 'GET';
if ($data) {
$this->path .= '?'.$this->buildQueryString($data);
}
return $this->doRequest();
}
function post($path, $data) {
$this->path = $path;
$this->method = 'POST';
$this->postdata = $this->buildQueryString($data);
return $this->doRequest();
}
function buildQueryString($data) {
$querystring = '';
if (is_array($data)) {
// Change data in to postable data
foreach ($data as $key => $val) {
if (is_array($val)) {
foreach ($val as $val2) {
$querystring .= urlencode($key).'='.urlencode($val2).'&';
}
} else {
$querystring .= urlencode($key).'='.urlencode($val).'&';
}
}
$querystring = substr($querystring, 0, -1); // Eliminate unnecessary &
} else {
$querystring = $data;
}
return $querystring;
}
function doRequest() {
// Performs the actual HTTP request, returning true or false depending on outcome
if (!$fp = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout)) {
// Set error message
switch($errno) {
case -3:
$this->errormsg = 'Socket creation failed (-3)';
case -4:
$this->errormsg = 'DNS lookup failure (-4)';
case -5:
$this->errormsg = 'Connection refused or timed out (-5)';
default:
$this->errormsg = 'Connection failed ('.$errno.')';
$this->errormsg .= ' '.$errstr;
$this->debug($this->errormsg);
}
return false;
}
socket_set_timeout($fp, $this->timeout);
$request = $this->buildRequest();
$this->debug('Request', $request);
fwrite($fp, $request);
// Reset all the variables that should not persist between requests
$this->headers = array();
$this->content = '';
$this->errormsg = '';
// Set a couple of flags
$inHeaders = true;
$atStart = true;
// Now start reading back the response
while (!feof($fp)) {
$line = fgets($fp, 4096);
if ($atStart) {
// Deal with first line of returned data
$atStart = false;
if (!preg_match('/HTTP\/(\\d\\.\\d)\\s*(\\d+)\\s*(.*)/', $line, $m)) {
$this->errormsg = "Status code line invalid: ".htmlentities($line);
$this->debug($this->errormsg);
return false;
}
$http_version = $m[1]; // not used
$this->status = $m[2];
$status_string = $m[3]; // not used
$this->debug(trim($line));
continue;
}
if ($inHeaders) {
if (trim($line) == '') {
$inHeaders = false;
$this->debug('Received Headers', $this->headers);
if ($this->headers_only) {
break; // Skip the rest of the input
}
continue;
}
if (!preg_match('/([^:]+):\\s*(.*)/', $line, $m)) {
// Skip to the next header
continue;
}
$key = strtolower(trim($m[1]));
$val = trim($m[2]);
// Deal with the possibility of multiple headers of same name
if (isset($this->headers[$key])) {
if (is_array($this->headers[$key])) {
$this->headers[$key][] = $val;
} else {
$this->headers[$key] = array($this->headers[$key], $val);
}
} else {
$this->headers[$key] = $val;
}
continue;
}
// We're not in the headers, so append the line to the contents
$this->content .= $line;
}
fclose($fp);
// If data is compressed, uncompress it
if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] == 'gzip') {
$this->debug('Content is gzip encoded, unzipping it');
$this->content = substr($this->content, 10); // See http://www.php.net/manual/en/function.gzencode.php
$this->content = gzinflate($this->content);
}
// If $persist_cookies, deal with any cookies
if ($this->persist_cookies && isset($this->headers['set-cookie']) && $this->host == $this->cookie_host) {
$cookies = $this->headers['set-cookie'];
if (!is_array($cookies)) {
$cookies = array($cookies);
}
foreach ($cookies as $cookie) {
if (preg_match('/([^=]+)=([^;]+);/', $cookie, $m)) {
$this->cookies[$m[1]] = $m[2];
}
}
// Record domain of cookies for security reasons
$this->cookie_host = $this->host;
}
// If $persist_referers, set the referer ready for the next request
if ($this->persist_referers) {
$this->debug('Persisting referer: '.$this->getRequestURL());
$this->referer = $this->getRequestURL();
}
// Finally, if handle_redirects and a redirect is sent, do that
if ($this->handle_redirects) {
if (++$this->redirect_count >= $this->max_redirects) {
$this->errormsg = 'Number of redirects exceeded maximum ('.$this->max_redirects.')';
$this->debug($this->errormsg);
$this->redirect_count = 0;
return false;
}
$location = isset($this->headers['location']) ? $this->headers['location'] : '';
$uri = isset($this->headers['uri']) ? $this->headers['uri'] : '';
if ($location || $uri) {
$url = parse_url($location.$uri);
// This will FAIL if redirect is to a different site
return $this->get($url['path']);
}
}
return true;
}
function buildRequest() {
$headers = array();
$headers[] = "{$this->method} {$this->path} HTTP/1.0"; // Using 1.1 leads to all manner of problems, such as "chunked" encoding
$headers[] = "Host: {$this->host}";
$headers[] = "User-Agent: {$this->user_agent}";
$headers[] = "Accept: {$this->accept}";
if ($this->use_gzip) {
$headers[] = "Accept-encoding: {$this->accept_encoding}";
}
$headers[] = "Accept-language: {$this->accept_language}";
if ($this->referer) {
$headers[] = "Referer: {$this->referer}";
}
// Cookies
if ($this->cookies) {
$cookie = 'Cookie: ';
foreach ($this->cookies as $key => $value) {
$cookie .= "$key=$value; ";
}
$headers[] = $cookie;
}
// Basic authentication
if ($this->username && $this->password) {
$headers[] = 'Authorization: BASIC '.base64_encode($this->username.':'.$this->password);
}
// If this is a POST, set the content type and length
if ($this->postdata) {
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
$headers[] = 'Content-Length: '.strlen($this->postdata);
}
$request = implode("\r\n", $headers)."\r\n\r\n".$this->postdata;
return $request;
}
function getStatus() {
return $this->status;
}
function getContent() {
return $this->content;
}
function getHeaders() {
return $this->headers;
}
function getHeader($header) {
$header = strtolower($header);
if (isset($this->headers[$header])) {
return $this->headers[$header];
} else {
return false;
}
}
function getError() {
return $this->errormsg;
}
function getCookies() {
return $this->cookies;
}
function getRequestURL() {
$url = 'http://'.$this->host;
if ($this->port != 80) {
$url .= ':'.$this->port;
}
$url .= $this->path;
return $url;
}
// Setter methods
function setUserAgent($string) {
$this->user_agent = $string;
}
function setAuthorization($username, $password) {
$this->username = $username;
$this->password = $password;
}
function setCookies($array) {
$this->cookies = $array;
}
// Option setting methods
function useGzip($boolean) {
$this->use_gzip = $boolean;
}
function setPersistCookies($boolean) {
$this->persist_cookies = $boolean;
}
function setPersistReferers($boolean) {
$this->persist_referers = $boolean;
}
function setHandleRedirects($boolean) {
$this->handle_redirects = $boolean;
}
function setMaxRedirects($num) {
$this->max_redirects = $num;
}
function setHeadersOnly($boolean) {
$this->headers_only = $boolean;
}
function setDebug($boolean) {
$this->debug = $boolean;
}
// "Quick" static methods
function quickGet($url) {
$bits = parse_url($url);
$host = $bits['host'];
$port = isset($bits['port']) ? $bits['port'] : 80;
$path = isset($bits['path']) ? $bits['path'] : '/';
if (isset($bits['query'])) {
$path .= '?'.$bits['query'];
}
$client = new HttpClient($host, $port);
if (!$client->get($path)) {
return false;
} else {
return $client->getContent();
}
}
function quickPost($url, $data) {
$bits = parse_url($url);
$host = $bits['host'];
$port = isset($bits['port']) ? $bits['port'] : 80;
$path = isset($bits['path']) ? $bits['path'] : '/';
$client = new HttpClient($host, $port);
if (!$client->post($path, $data)) {
return false;
} else {
return $client->getContent();
}
}
function debug($msg, $object = false) {
if ($this->debug) {
print '<div style="border: 1px solid red; padding: 0.5em; margin: 0.5em;"><strong>HttpClient Debug:</strong> '.$msg;
if ($object) {
ob_start();
print_r($object);
$content = htmlentities(ob_get_contents());
ob_end_clean();
print '<pre>'.$content.'</pre>';
}
print '</div>';
}
}
}
?>
1、如何设 置请求等待时间
在httpd.conf里面设置:
TimeOut n
其中n为整数,单位是秒。
设置这个TimeOut适用于三种情况:
2、如何接收一个get请求的总时间
接收一个post和put请求的TCP包之间的时间
TCP包传输中的响应(ack)时间间隔
3、如何使得apache监听在特定的端口
修改httpd.conf里面关于Listen的选项,例如:
Listen 8000
是使apache监听在8000端口
而如果要同时指定监听端口和监听地址,可以使用:
Listen 192.170.2.1:80
Listen 192.170.2.5:8000
这样就使得apache同时监听在192.170.2.1的80端口和192.170.2.5的8000端口。
当然也可以在httpd.conf里面设置:
Port 80
这样来实现类似的效果。
4、如何设置apache的最大空闲进程数
修改httpd.conf,在里面设置:
MaxSpareServers n
其中n是一个整数。这样当空闲进程超过n的时候,apache主进程会杀掉多余的空闲进程而保持空闲进程在n,节省了系统资源。如果在一个apache非常繁忙的站点调节这个参数才是必要的,但是在任何时候把这个参数调到很大都不是一个好主意。
同时也可以设置:
MinSpareServers n
来限制最少空闲进程数目来加快反应速度。
5、apache如何设置启动时的子服务进程个数
在httpd.conf里面设置:
StartServers 5
这样启动apache后就有5个空闲子进程等待接受请求。
也可以参考MinSpareServers和MaxSpareServers设置。
6、如何在apache中设置每个连接的最大请求数
在httpd.conf里面设置:
MaxKeepAliveRequests 100
这样就能保证在一个连接中,如果同时请求数达到100就不再响应这个连接的新请求,保证了系统资源不会被某个连接大量占用。但是在实际配置中要求尽量把这个数值调高来获得较高的系统性能。
7、如何在apache中设置session的持续时间
在apache1.2以上的版本中,可以在httpd.conf里面设置:
KeepAlive on
KeepAliveTimeout 15
这样就能限制每个session的保持时间是15秒。session的使用可以使得很多请求都可以通过同一个tcp连接来发送,节约了网络资源和系统资源。
8、如何使得apache对客户端进行域名验证
可以在httpd.conf里面设置:
HostnameLookups on|off|double
如果是使用on,那么只有进行一次反查,如果用double,那么进行反查之后还要进行一次正向解析,只有两次的结果互相符合才行,而off就是不进行域名验证。
如果为了安全,建议使用double;为了加快访问速度,建议使用off。
9、如何使得apache只监听在特定的ip
修改httpd.conf,在里面使用
BindAddress 192.168.0.1
这样就能使得apache只监听外界对192.168.0.1的http请求。如果使用:
BindAddress *
就表明apache监听所有网络接口上的http请求。
当然用防火墙也可以实现。
10、apache中如何限制http请求的消息主体的大小
在httpd.conf里面设置:
LimitRequestBody n
n是整数,单位是byte。
cgi脚本一般把表单里面内容作为消息的主体提交给服务器处理,所以现在消息主体的大小在使用cgi的时候很有用。比如使用cgi来上传文件,如果有设置:
LimitRequestBody 102400
那么上传文件超过100k的时候就会报错。
11、如何修改apache的文档根目录
修改httpd.conf里面的DocumentRoot选项到指定的目录,比如:
DocumentRoot /www/htdocs
这样http://localhost/index.html就是对应/www/htdocs/index.html
12、如何修改apache的最大连接数
在httpd.conf中设置:
MaxClients n
n是整数,表示最大连接数,取值范围在1和256之间,如果要让apache支持更多的连接数,那么需要修改源码中的httpd.h文件,把定义的HARD_SERVER_LIMIT值改大然后再编译。
13、如何使每个用户有独立的cgi-bin目录
有两种可选择的方法:
(1)在Apache配置文件里面关于public_html的设置后面加入下面的属性:
scrīptAliasMatch ^/~([^/]*)/cgi-bin/(.*) /home/$1/cgi-bin/$2
(2)在Apache配置文件里面关于public_html的设置里面加入下面的属性:
<Directory /home/*/public_html/cgi-bin>
Options ExecCGI
SetHandler cgi-scrīpt
</Directory>
14、如何调整Apache的最大进程数
Apache允许为请求开的最大进程数是256,MaxClients的限制是256.如果用户多了,用户就只能看到Waiting for reply....然后等到下一个可用进程的出现。这个最大数,是Apache的程序决定的--它的NT版可以有1024,但Unix版只有256,你可 以在src/include/httpd.h中看到:
#ifndef HARD_SERVER_LIMIT
#ifdef WIN32
#define HARD_SERVER_LIMIT 1024
#else
#define HARD_SERVER_LIMIT 256
#endif
#endif
你可以把它调到1024,然后再编译你的系统。
15、如何屏蔽来自某个Internet地址的用户访问Apache服务器
可以使用deny和allow来限制访问,比如要禁止202.202.202.xx网络的用户访问:
<Directory /www/htdocs>
order deny,allow
deny from 202.202.202.0/24
</Directory>
16、如何在日志里面记录apache浏览器和引用信息
你需要把mod_log_config编译到你的Apache服务器中,然后使用下面类似的配置:
CustomLog logs/access_log "%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i""
17、如何修改Apache返回的头部信息
问题分析:当客户端连接到Apache服务器的时候,Apache一般会返回服务器版本、非缺省模块等信息,例如:
Server: Apache/1.3.26 (Unix) mod_perl/1.26
解决:
你可以在Apache的配置文件里面作如下设置让它返回的关于服务器的信息减少到最少:
ServerTokens Prod
注意:
这样设置以后Apache还会返回一定的服务器信息,比如:
Server: Apache
但是这个不会对服务器安全产生太多的影响,因为很多扫描软件是扫描的时候是不顾你服务器返回的头部信息的。你如果想把服务器返回的相关信息变成:
Server: It iS a nOnE-aPaCHe Server
那么你就要去修改源码了。






