ubuntu

Ubuntu 10.04 LTS RC发布

今天,2010年4月23日,Ubuntu 开发团队发布了 Ubuntu 10.04 LTS 的 RC 版本。6天以后,也就是2010年4月29日, Ubuntu 10.04 将正式发布

上一张Ubuntu 10.04 LTS RC的截图

ubuntu10.04-lts-rc桌面截图

ubuntu10.04-lts-rc桌面截图

因为是从9.10 update上来的,flash显示中文不正常,用老方法解决这个问题

weiqk@weiqk-laptop:~$ sudo rm /etc/fonts/conf.d/49-sansserif.conf

Ubuntu 10.04:代号“Lucid Lynx”

LTS:长期支持

Tags: , ,

星期五, 四月 23rd, 2010 网络 没有评论

ubuntu修改时区

查看时区

bear@njava:#  date -R

修改为+8时区的上海

bear@njava:#  cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Tags: ,

星期五, 四月 2nd, 2010 服务器 没有评论

cacti通过snmp监控ubuntu9.10网卡流量遇到的问题

折腾无线,snmp总是链接不上,debug报如下错误;

+ Running data query [1].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.2.1.2.2.1.1'
+ No SNMP data returned
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'

谷歌百度,终于找到解决办法,记录之。。。

bear@njava:/var/www/njava$ sudo vi /etc/snmp/snmpd.conf 
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):
# sec.name  source          community
#com2sec paranoid  default         public
#com2sec paranoid  default         njava
com2sec readonly  default         public
bear@njava:/var/www/njava$ sudo /etc/init.d/snmpd restart

获取到后的数据源

+ Running data query [1].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.2.1.2.2.1.1'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.1' value: '1'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.2' value: '2'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.3' value: '3'
+ Located input field 'ifIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.1'
+ Found item [ifIndex='1'] index: 1 [from value]
+ Found item [ifIndex='2'] index: 2 [from value]
+ Found item [ifIndex='3'] index: 3 [from value]
+ Located input field 'ifOperStatus' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.8'
+ Found item [ifOperStatus='Up'] index: 1 [from value]
+ Found item [ifOperStatus='Up'] index: 2 [from value]
+ Found item [ifOperStatus='Down'] index: 3 [from value]
+ Located input field 'ifDescr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.2'
+ Found item [ifDescr='lo'] index: 1 [from value]
+ Found item [ifDescr='eth0'] index: 2 [from value]
+ Found item [ifDescr='eth1'] index: 3 [from value]
+ Located input field 'ifName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.31.1.1.1.1'
+ Found item [ifName='lo'] index: 1 [from value]
+ Found item [ifName='eth0'] index: 2 [from value]
+ Found item [ifName='eth1'] index: 3 [from value]
+ Located input field 'ifAlias' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.31.1.1.1.18'
+ Found item [ifAlias=''] index: 1 [from value]
+ Found item [ifAlias=''] index: 2 [from value]
+ Found item [ifAlias=''] index: 3 [from value]
+ Located input field 'ifType' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.3'
+ Found item [ifType='softwareLoopback(24)'] index: 1 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 2 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 3 [from value]
+ Located input field 'ifSpeed' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.5'
+ Found item [ifSpeed='10000000'] index: 1 [from value]
+ Found item [ifSpeed='100000000'] index: 2 [from value]
+ Found item [ifSpeed='0'] index: 3 [from value]
+ Located input field 'ifHwAddr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.6'
+ Found item [ifHwAddr=''] index: 1 [from value]
+ Found item [ifHwAddr='00:0D:60:D4:BC:04'] index: 2 [from value]
+ Found item [ifHwAddr='00:0D:60:D4:BC:05'] index: 3 [from value]
+ Located input field 'ifIP' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.4.20.1.2'
+ Found item [ifIP='127.0.0.1'] index: 1 [from regexp oid parse]
+ Found item [ifIP='8.8.8.8'] index: 2 [from regexp oid parse]
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'

参考:http://www.linuxquestions.org/questions/linux-networking-3/cacti-traffic-stats-snmp-config-prob-378983/

Tags: , ,

星期四, 四月 1st, 2010 服务器 没有评论

在ubuntu9.10下用awstats分析nginx日志

1 下载awstats
sudo apt-get install awstats 弄下来的版本在执行awstats_configure.pl时候找不到wwwroot目录结构,所以重新直接下载awstats了

bear@njava:~$axel http://prdownloads.sourceforge.net/awstats/awstats-6.95.tar.gz
bear@njava:~$tar xzvf awstats-6.95.tar.gz

2 执行配置脚本
先把 awstats目录复制到/usr/local/awstats,脚本是按照这个目录结构去执行的,如果不是在这/usr/local/awstats里,运行时回提示的

bear@njava:/usr/local/awstats/tools$ sudo ./awstats_configure.pl 
[sudo] password for bear: 

----- AWStats awstats_configure 1.0 (build 1.8) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).

-----> Running OS detected: Linux, BSD or Unix

-----> Check for web server install

Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> none     #因为没法自动配置nginx,所以none

Your web server config file(s) could not be found.
You will need to setup your web server manually to declare AWStats
script as a CGI, if you want to build reports dynamically.
See AWStats setup documentation (file docs/index.html)

-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
  File awstats.model.conf updated.

-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y  

-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> www.njava.com   #配置名字

-----> Define config file path
In which directory do you plan to store your config file(s) ?
Default: /etc/awstats
Directory path to store config file(s) (Enter for default):
> 

-----> Create config file '/etc/awstats/awstats.www.njava.com.conf'
 Config file /etc/awstats/awstats.www.njava.com.conf created.

-----> Add update process inside a scheduler
Sorry, configure.pl does not support automatic add to cron yet.
You can do it manually by adding the following command to your cron:
/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.njava.com
Or if you have several config files and prefer having only one command:
/usr/local/awstats/tools/awstats_updateall.pl now
Press ENTER to continue... 


A SIMPLE config file has been created: /etc/awstats/awstats.www.njava.com.conf
You should have a look inside to check and change manually main parameters.
You can then manually update your statistics for 'www.njava.com' with command:
> perl awstats.pl -update -config=www.njava.com
You can also build static report pages for 'www.njava.com' with command:
> perl awstats.pl -output=pagetype -config=www.njava.com

Press ENTER to finish...

bear@njava:/usr/local/awstats/tools$ 

3 修改awstats配置文件
修改awstats.conf

bear@njava:/usr/local/awstats/tools$ sudo vi /etc/awstats/awstats.conf
# LogFormat = 1
# LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"
#
# Example for IIS:
# LogFormat = 2
#
LogFormat =1  #继续使用apache的默认格式

AllowToUpdateStatsFromBrowser=1 #允许浏览器刷新,njava的流量小,这个可以有

Include "/etc/awstats/awstats.www.njava.com.conf" #包含njava的配置

4 修改nginx的日志格式

bear@njava:/etc/awstats$sudo  vi /etc/nginx/nginx.conf
user www-data;
worker_processes  2;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
    # multi_accept on;
}

http {
    include       /etc/nginx/mime.types;

    #main 把nginx的输出日志定义成了apache格式的日志
     log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for';

    access_log  /var/log/nginx/access.log main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

4 修改awstats.www.njava.com.conf

bear@njava:/usr/local/awstats/tools$ sudo vi /etc/awstats/awstats.conf
LogFile="/var/log/nginx/www.njava.access.log"

要看相应域名下的日志使用
http://awstats.njava.com/awstats.pl?config=cdn.njava.com

5 配置nginx
先确保了nginx已经代理了nginx-fcgi,可以参看 xxx

bear@njava:/etc/awstats$ vi /etc/nginx/sites-enabled/awstats.njava.com  

server {
        listen   80;
        server_name awstats.njava.com;

        access_log   /var/log/nginx/awstats.log main;
        error_log    /var/log/nginx/awstats_error.log;

        root /usr/local/awstats/wwwroot;
        #auth_basic   "Restricted";
       #auth_basic_user_file  /etc/nginx/conf/awstats;

        location / {
             rewrite ^ /awstats.pl?config=freshventure.info;
        }

        location ~ .*(\.cgi|\.pl?)$ {
               gzip off; #gzip makes scripts feel slower since they have to complete before getting gzipped
               root /usr/local/awstats/wwwroot/cgi-bin;
               #fastcgi_pass 127.0.0.1:8000;
                fastcgi_pass   unix:/tmp/nginx-fcgi.sock;
                fastcgi_index awstats.pl;
               fastcgi_param SCRIPT_FILENAME            $document_root$fastcgi_script_name;
               include        fastcgi_params;
        }

         location /icon {
                alias /usr/local/awstats/wwwroot/icon;
  location /icon {
                alias /usr/local/awstats/wwwroot/icon;
        }
  location /js {
                alias /usr/local/awstats/wwwroot/js;
        }

  location /css {
                alias /usr/local/awstats/wwwroot/css;
        }

  location /classes {
                alias /usr/local/awstats/wwwroot/classes;
        }
}

为目录添加用户验证

bear@njava:/etc/nginx/conf$ sudo htpasswd -c awstats admin
New password: 
Re-type new password: 
Adding password for user admin
bear@njava:/etc/nginx/conf$

可以把/etc/nginx/sites-enabled/awstats.njava.com中出现的这个注释掉了
#auth_basic “Restricted”;
#auth_basic_user_file /etc/nginx/conf/awstats;

Tags: , ,

星期一, 三月 29th, 2010 服务器 没有评论

在ubuntu9.10下用cacti监控nginx运行

Cacti 在英文中的意思是仙人掌的意思,Cacti是一套基于PHP,MySQL,SNMP及RRDTool开发的网络流量监测图形分析工具。它通过snmpget来获取数据,使用 RRDtool绘画图形,而且你完全可以不需要了解RRDtool复杂的参数。它提供了非常强大的数据和用户管理功能,可以指定每一个用户能查看树状结 构、host以及任何一张图,还可以与LDAP结合进行用户验证,同时也能自己增加模板,功能非常强大完善。http://www.cacti.net/

1 安装cacti

bear@njava:/$  sudo apt-get install cacti-cactid 

2 下载cacti-nginx脚本

bear@njava:/$ wget http://forums.cacti.net/download.php?id=12676
bear@njava:/$ tar -xzvf cacti-nginx.tar.gz
bear@njava:/$ sudo cp cacti-nginx/get_nginx_socket_status.pl /usr/share/cacti/site/scripts
bear@njava:/$ sudo cp cacti-nginx/get_nginx_clients_status.pl /usr/share/cacti/site/scripts
bear@njava:/$ sudo chmod 755 /usr/share/cacti/site/scripts/get_nginx*

3 检查脚本

bear@njava:/$ /usr/share/cacti/site/scripts/get_nginx_socket_status.pl http://www.njava.com/nginx_status

4 配置cacti的nginx虚拟主机

 
bear@njava:$ sudo vi /etc/nginx/sites-available/cacti
server {
        listen   80;
        server_name cacti.njava.com;
        access_log  /var/log/nginx/cacti.access.log;

        location / {
                root   /usr/share/cacti/site;
                index  index.html index.htm index.php;
        }

        location ~ \.php$ {
                fastcgi_pass unix:/tmp/php-cgi.njava.sock;
                fastcgi_index index.php;
                set $path_info "/";
                set $real_script_name $fastcgi_script_name;
                if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                    set $real_script_name $1;
                    set $path_info $2;
                }
               fastcgi_param SCRIPT_FILENAME /usr/share/cacti/site/$real_script_name;
               fastcgi_param script_name $real_script_name;
               fastcgi_param path_info $path_info;
               include /etc/nginx/fastcgi_params;
        }
}

bear@njava:$ sudo ln -s /etc/nginx/sites-available/cacti  /etc/nginx/sites-enable/cacti

bear@njava:$ sudo /etc/init.d/nginx reload

5 从cacti的UI上传cacti模板

cacti_graph_template_nginx_clients_stat.xml
cacti_graph_template_nginx_sockets_stat.xml

Tags: , ,

星期日, 三月 28th, 2010 服务器 没有评论

ubuntu启动加载调整sysv-rc-conf

1 安装sysv-rc-conf

bear@njava:~$ sudo apt-get update
bear@njava:~$ sudo apt-get install sysv-rc-conf

2 运行

bear@njava:~$ sudo sysv-rc-conf

3 运行等级
开机进程执行顺序如下:
运行等级 S:开机进程中的第一个运行等级。/etc/init.d/rcS脚本将被调用到开启并且/etc/rcS.d目录下的所有进程将被执行。
运行等级 1:单用户模式。/etc/rc1.d目录下的所有进程将被执行。
运行等级 2,3,4,5:在debian系统里是多用户环境,可能不包含图形用户界面。同样的,在相应目录下的进程将被运行。
运行等级 0:关闭计算机
运行等级 6:重起计算机

Tags: ,

星期六, 三月 27th, 2010 服务器 没有评论

给ubuntu9.10下的nginx安装nagios监控

1 开权限

root@njava:~# sudo -s
root@njava:~# useradd -m -s /bin/bash nagios
root@njava:~# passwd nagios
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@njava:~# groupadd nagios
groupadd: group 'nagios' already exists
root@njava:~# usermod -G nagios nagios
root@njava:~# groupadd nagcmd
root@njava:~# usermod -a -G nagcmd nagios
root@njava:~# usermod -a -G nagcmd www-data
root@njava:~# 

2 下软件

root@njava:~# axel http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz
root@njava:~# axel http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
root@njava:~# tar -xzvf nagios-3.2.1.tar.gz 

3 编译设置

root@njava:~# cd nagios-3.2.1
root@njava:~/nagios-3.2.1# ./configure --with-command-group=nagcmd
root@njava:~/nagios-3.2.1# make all
root@njava:~/nagios-3.2.1# make install
root@njava:~/nagios-3.2.1# make install-init
root@njava:~/nagios-3.2.1# make install-config
root@njava:~/nagios-3.2.1# make install-commandmode

4 安装apache配置,对nagios无用

root@njava:~/nagios-3.2.1# make install-webconf

5 配置nginx

root@njava:~/nagios-plugins-1.4.14# cat /etc/nginx/sites-available/nagios 
server {
	listen   80;
	server_name nagios.njava.com;
        
	access_log  /var/log/nginx/nagios.access.log;

	location / {
		root   /usr/local/nagios/share;
		index  index.php;
        }

        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                set $path_info "/";
                set $real_script_name $fastcgi_script_name;
                if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
                    set $real_script_name $1;
                    set $path_info $2;
                }
               fastcgi_param SCRIPT_FILENAME /usr/local/nagios/share/$real_script_name;
               fastcgi_param script_name $real_script_name;
               fastcgi_param path_info $path_info;
               include /etc/nginx/fastcgi_params;
        }
       location /nagios/images {
                alias /usr/local/nagios/share/images;
        }
                   
        location /nagios/stylesheets {
                alias /usr/local/nagios/share/stylesheets;
          }


         location /cgi-bin {
                 alias /usr/local/nagios/sbin;

    }

    location ~ \.cgi$ {

        root           /usr/local/nagios/sbin;

        rewrite ^/cgi-bin/(.*)\.cgi /$1.cgi break;

        fastcgi_index  index.cgi;

        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

        include        nginx_fcgi_params;

        fastcgi_read_timeout    5m;

        fastcgi_pass   unix:/var/run/nginx-fcgi.sock;

    }

6 安装Nagios Plugins

root@njava:~# tar -xzvf nagios-plugins-1.4.14.tar.gz
root@njava:~# cd nagios-plugins-1.4.14
root@njava:~/nagios-plugins-1.4.14# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
...
...            --with-apt-get-command: /usr/bin/apt-get
              --with-ping6-command: /bin/ping6 -n -U -w %d -c %d %s
               --with-ping-command: /bin/ping -n -U -w %d -c %d %s
                       --with-ipv6: yes
                      --with-mysql: no
                    --with-openssl: yes
                     --with-gnutls: no
               --enable-extra-opts: no
                       --with-perl: /usr/bin/perl
             --enable-perl-modules: no
                     --with-cgiurl: /nagios/cgi-bin
               --with-trusted-path: /bin:/sbin:/usr/bin:/usr/sbin
                   --enable-libtap: no
root@njava:~/nagios-plugins-1.4.14# make && make install

7 启动nagios相关设置

root@njava:~/nagios-plugins-1.4.14# ln -s /etc/init.d/nagios /etc/rcS.d/
S99nagios

9 nagios设置
用户登录验证

root@njava:~/nagios-plugins-1.4.14#vi /usr/local/nagios/etc/cgi.cfg
    use_authentication=0

CGI工作目录

root@njava:~/nagios-plugins-1.4.14#vi /usr/local/nagios/share/config.inc.php
$cfg['cgi_base_url']='/cgi-bin';

8 效验nagios执行nagios

root@njava:~/nagios-plugins-1.4.14# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Things look okay - No serious problems were detected during the pre-flight check
root@njava:~/nagios-plugins-1.4.14# /etc/init.d/nagios start

参考:
1 http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html

Tags: , , ,

星期一, 三月 22nd, 2010 服务器 没有评论

ubuntu9.10安装nginx0.8.34

源里的是nginx0.7.62,决定把他升级到nginx0.8.34

1 卸载nginx0.7.62

bear@bear-laptop:~/$ sudo apt-get remove nginx

2 安装编译环境

bear@bear-laptop:~/soft/nginx-0.8.34$ sudo sudo apt-get install build-essential libpcre3-dev libssl-dev libxslt-dev libgd2-xpm-dev libgeoip-dev

4 下载nginx0.8.34

bear@bear-laptop:~/soft$ axel http://nginx.org/download/nginx-0.8.34.tar.gz
bear@bear-laptop:~/soft$ tar -xzvf nginx-0.8.34.tar.gz

5 下载upstream fair 模块

bear@bear-laptop:~/soft$ wget http://github.com/gnosek/nginx-upstream-fair/tarball/master
bear@bear-laptop:~/soft$ tar -xzvf gnosek-nginx-upstream-fair-2131c73.tar.gz

6 编译

bear@bear-laptop:~/soft$ cd nginx-0.8.34/
bear@bear-laptop:~/soft/nginx-0.8.34$ ./configure --conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-http_gzip_static_module --with-mail --with-mail_ssl_module --with-ipv6 --with-http_realip_module --with-http_geoip_module --with-http_xslt_module --with-http_image_filter_module --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --add-module=../gnosek-nginx-upstream-fair-2131c73

....

...

Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ using sha1 library: /usr/include/openssl
+ using system zlib library

nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/etc/nginx"
nginx configuration file: "/etc/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/var/lib/nginx/body"
nginx http proxy temporary files: "/var/lib/nginx/proxy"
nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"

bear@bear-laptop:~/soft/nginx-0.8.34$ make

bear@bear-laptop:~/soft/nginx-0.8.34$ sudo make install
make -f objs/Makefile install
make[1]: 正在进入目录 `/home/bear/soft/nginx-0.8.34'
test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx'
test -d '/usr/local/nginx/sbin'         || mkdir -p '/usr/local/nginx/sbin'
test ! -f '/usr/local/nginx/sbin/nginx'         || mv '/usr/local/nginx/sbin/nginx'             '/usr/local/nginx/sbin/nginx.old'
cp objs/nginx '/usr/local/nginx/sbin/nginx'
test -d '/etc/nginx'         || mkdir -p '/etc/nginx'
cp conf/koi-win '/etc/nginx'
cp conf/koi-utf '/etc/nginx'
cp conf/win-utf '/etc/nginx'
test -f '/etc/nginx/mime.types'         || cp conf/mime.types '/etc/nginx'
cp conf/mime.types '/etc/nginx/mime.types.default'
test -f '/etc/nginx/fastcgi_params'         || cp conf/fastcgi_params '/etc/nginx'
cp conf/fastcgi_params         '/etc/nginx/fastcgi_params.default'
test -f '/etc/nginx/fastcgi.conf'         || cp conf/fastcgi.conf '/etc/nginx'
cp conf/fastcgi.conf '/etc/nginx/fastcgi.conf.default'
test -f '/etc/nginx/nginx.conf'         || cp conf/nginx.conf '/etc/nginx/nginx.conf'
cp conf/nginx.conf '/etc/nginx/nginx.conf.default'
test -d '/var/run'         || mkdir -p '/var/run'
test -d '/var/log/nginx' ||         mkdir -p '/var/log/nginx'
test -d '/usr/local/nginx/html'         || cp -r html '/usr/local/nginx'
test -d '/var/log/nginx' ||         mkdir -p '/var/log/nginx'
make[1]:正在离开目录 `/home/bear/soft/nginx-0.8.34'
bear@bear-laptop:~/soft/nginx-0.8.34$

7 修改 /etc/init.d/nginx 脚本

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/nginx/sbin/nginx
NAME=nginx
DESC=nginx

test -x $DAEMON || exit 0

# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi

set -e

. /lib/lsb/init-functions

test_nginx_config() {
if /usr/local/nginx/sbin/nginx -t
then
return 0
else
return $?
fi
}

8 update-rc脚本

sudo update-rc.d -f nginx defaults

9 over

Tags: ,

星期一, 三月 22nd, 2010 服务器 没有评论
Pages: Prev 1 2
1LMooBmUE153Wnd3zDryWvDyXxQudbFxDr