由于Ubuntu 9.04已经包含了nginx,所以根本不要编译,安装超简单!

修改/etc/apt/sources.list文件内容为国内镜像,然后运行:

apt-get update apt-get install nginx  

即可完成安装。启动nginx:

/etc/init.d/nginx start

然后就可以访问http://localhost/了,一切正常!如果不能访问,先不要继续,看看是什么原因,解决之后再继续。

安装php和MySQL:

apt-get install php5-cli php5-cgi mysql-server-5.0 php5-mysql spawn-fcgi  

修改nginx的配置文件:/etc/nginx/sites-available/default
修改 server_name 为你的hostname;
修改index的一行修改为:
index index.php index.html index.htm;

去掉下面部分的注释:

location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name; include /etc/nginx/fastcgi_params; }  

重新启动nginx:

/etc/init.d/nginx stop /etc/init.d/nginx start

启动fastcgi php:

spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi  

为了让php-cgi开机自启动:

cd /etc/init.d  
cp nginx php-cgi  
vim php-cgi  

替换nginx为php-cgi并修改相应部分为:

DAEMON=/usr/bin/spawn-fcgi  
DAEMON_OPTS="-a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi"

 … stop) 
echo -n "Stopping $DESC: " pkill -9 php-cgi echo "$NAME."  

然后运行rcconf设置php-cgi为开机自启动

在/var/www/nginx-default/目录下创建一个文件:

echo '' > /var/www/nginx-default/index.php  

最后用浏览器测试是否能够解析php脚本。一切OK。为了优化和缓存php,我们需要安装eAccelerator,安装必须还有开发工具,开发库已经PHP5-DEV。

apt-get install build-essential php5-dev  
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2  
tar xvf eaccelerator-0.9.6.1.tar.bz2  
cd eaccelerator-0.9.6.1  
phpize  
./configure –enable-eaccelerator=shared –with-php-config=/usr/bin/php-config 
make && make install  
mkdir /var/cache/eaccelerator  
chown www-data.www-data /var/cache/eaccelerator  

编辑/etc/php5/cgi/php.ini,在最后添加内容:

[eaccelerator] 
extension="eaccelerator.so"  
eaccelerator.shm_size="16"  
eaccelerator.cache_dir="/var/cache/eaccelerator"  
eaccelerator.enable="1" eaccelerator.optimizer="1"  
eaccelerator.check_mtime="1"  
eaccelerator.debug="0"  
eaccelerator.filter=""  
eaccelerator.shm_max="0"  
eaccelerator.shm_ttl="0"  
eaccelerator.shm_prune_period="0"  
eaccelerator.shm_only="0"  
eaccelerator.compress="1"  
eaccelerator.compress_level="9"  

最后重启nginx和php-cgi.


嘿嘿,终于找到HP 540刷SLIC 2.1的方法了。现分享如下:
下载 这个压缩文件,解压缩,运行文件夹中的HPQFlash.exe文件,两分钟之后刷完后,会提示重启,重启之后,就可以硬激活WIN7了,哈哈,我再不需要什么神key了。


This’s a article show you howto use pubkey authtication under CentOS. Ok, let’s continue.
First, we need enable Pubkey Authtication.

vi /etc/ssh/sshd_config  

uncomment and modify these lines below:

 PubkeyAuthentication yes  
 AuthorizedKeysFile .ssh/authorized_keys  
 PasswordAuthentication no

save file and quit vi. what we did is tell ssh daemon to use PubkeyAuthentication instead of traditional PasswordAuthenrication. avoid middleman attack.

right now restart ssh daemon service.use command below:

service sshd restart  

Second, generate our pubkey through this command ssh-keygen. and i think you should have a good habit, when you find an unknown well command, you should use man to understand and know it.

ssh-keygen -t dsa  

okay, follow instructions to complete your key generation.

right now we have 2 files under /home/USERNAME/.ssh, named id_dsa and id_dsa.pub. what should we do next? set proper permission and rename iddsa.pub to authorizedkeys.

mv /home/USERNAME/.ssh/id_dsa.pub /home/USERNAME/.ssh/authorized_keys  
chmod 644 /home/USERNAME/.ssh/authorized_keys  
chmod 700 /home/USERNAME/.ssh  

After that, download your id_dsa for secureCRT by any SFTP clients or scp. Well, right now we have done with Server’s work. Below it’ll show you how to use pubkey to log in your Server.

Open SecureCRT, Click “New Session”, fill with your server’s ip, specified port, your username, click ok to close dialog window. Then, right click the session you created just now, click Properties, and choose SSH2 Category on the left, authentication area, uncheck PasswordAuthentication, single click “PublicKey”, then click “Properties”, “Use Identify or certificate file”, browser your id_dsa downloaded just now, click ok to close dialog.

Well, i think you can connect to your server without any password. Of course, for secure reason, you still need set passphrase and keep your files iddsa and iddsa.pub safe. Hypothetically, if you have more then one server, you can use your id_dsa.pub as many as you wish.


CentOS 5.5操作系统,在/var/log/message中出现

Will not restore a file with more than one hard link (/etc/resolv.conf)
No such file or directory

的错误。

可以看出是/etc/resolv.conf的硬连接,inode出错了,所以需要将其删除,重建硬连接即可。

其解决办法如下:

$ ls -i /etc/resolv.conf #先得到inode信息  
 16711694 /etc/resolv.conf  
$ sudo find /etc -inum 16711694#查找硬连接  
 Password:  
/etc/sysconfig/networking/profiles/default/resolv.conf  
/etc/resolv.conf  
$ sudo /usr/sbin/lsof|grep resolv.conf #确认这个文件没有被打开或运行  
$ sudo rm /etc/sysconfig/networking/profiles/default/resolv.conf #删除损坏的硬连接  
$ sudo restorecon /etc/resolv.conf  
$ sudo ln /etc/resolv.conf /etc/sysconfig/networking/profiles/default/resolv.conf #重建硬连接