FreeBSD8_mysql5_php_nginx安装

1.freebsd最小化安装
    sysinstall安装port
    #sysinstall
     Custum选择ports安装选项
     Configure->Distributions->DVD/CD
2.安装axel(多线程下载工具,加速下载)
    cd /usr/ports/ftp/axel/
    make install
    vi /etc/make.conf
    #加入以下内容(注意加入粘贴以下内容时要把每行后面的空格去掉,不然ports安装软件时报错)
     FETCH_CMD=axel
     FETCH_BEFORE_ARGS= -n 10 -a
     FETCH_AFTER_ARGS=
     DISABLE_SIZE=yes
     MASTER_SITE_OVERRIDE?=\
     http://ports.hshh.org/${DIST_SUBDIR}/\
     http://ports.cn.freebsd.org/${DIST_SUBDIR}/\
     ftp://ftp.freeBSDchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
     MASTER_SITE_OVERRIDE?=${MASTER_SITE_BACKUP}

3.使用portsnap升级port目录树
    vi /etc/portsnap.conf
    把SERVERNAME=portsnap.freebsd.org
    修改成:
    SERVERNAME=portsnap.hshh.org
    首次使用portsnap执行
    portsnap fetch extract
    再次更新使用
    portsnap fetch update
   
4.安装bash
    cd /usr/ports/shells/bash3
    make install
    修改登陆使用bash
    chsh -s /usr/local/bin/bash
    #使bash下显示中文
        vi ~/.login_conf
    #添加下面
        me:\
    :lang=zh_CN.UTF-8:\
    :setenv=LC_ALL=zh_CN.UTF-8:\
    :setenv=LC_COLLATE=zh_CN.UTF-8:\
    :setenv=LC_CTYPE=zh_CN.UTF-8:\
    :setenv=LC_MESSAGES=zh_CN.UTF-8:\
    :setenv=LC_MONETARY=zh_CN.UTF-8:\
    :setenv=LC_NUMERIC=zh_CN.UTF-8:\
    :setenv=LC_TIME=zh_CN.UTF-8:\
    :charset=UTF-8:\
    :xmodifiers="@im=gcin": #Set gcin as the XIM Input Server

    4.1使bash像linux下显示不同颜色
        cd /usr/ports/misc/gnuls
        make install clean           
        -------------------------------   
        vim ~/.profile
        则修改.shrc文件加入下列:
        alias ls='gnuls --color'
        alias ls='ls -FG'
5.

6.安装vim编辑器
    cd /usr/ports/editors/vim-lite
    make -DWITHOUT_X11 install
    #进入当前用户~目录建立.vimrc配置文件
        vim /root/.vimrc
        #添加下列
            syntax on
            set nocompatible
            set number
            set autoindent
            set smartindent
            set expandtab    
            set tabstop=4
            set shiftwidth=4
            set showmatch
            set cursorline
            set nobackup
            set ruler
            set fileencodings=utf-8,gb2312,gbk,gb18030
            set termencoding=utf-8
            set fileformats=unix
            set encoding=prc
            set hlsearch   
            set incsearch
            set fdm=indent   
    cp /root/.vimrc ~
   
7.安装sudo不用登陆root用户执行wheel组权限操作
    cd /usr/ports/security/sudo
    make install
    sudo的配置文件在/usr/local/etc/sudoers里面。sudo的配置文件不应直接编辑,而应使用 visudo 来进行修改
    %wheel ALL=(ALL) ALL
    这个命令指定了wheel这个组的所有者可以使用全部的权限。
    Defaults:M-gtuiw timestamp_timeout=0, runaspw, passwd_tries=1
    这个命令设置密码在一段时间后自动退出
   
   
   
8.安装mysql
    8.1 添加mysql用户
            sudo sysinstall->configure->adduser mysql:mysql
           
    8.2    ports安装mysql
                cd /usr/ports/databases/mysql55-server
                 make WITH_CHARSET=utf8 WITH_XCHARSET=all WITH_PROC_SCOPE_PTH=yes BUILD_OPTIMIZED=yes BUILD_STATIC=yes SKIP_DNS_CHECK=yes WITHOUT_INNODB=no install clean
                #成功后显示如下信息
                #Remember to run mysql_upgrade (with the optional --datadir=<dbdir> flag)
                #the first time you start the MySQL server after an upgrade from an
                #earlier version.
    8.3 创建MySQL数据库存放目录
                mkdir -p /usr/local/data0/mysql/3306/data/
                mkdir -p /usr/local/data0/mysql/3306/binlog/
                mkdir -p /usr/local/data0/mysql/3306/relaylog/
                chown -R mysql:mysql /usr/local/data0/mysql/
    8.4 以mysql用户帐号的身份建立数据表
                mysql_install_db --datadir=/usr/local/data0/mysql/3306/data --user=mysql
    8.5 创建my.cnf配置文件               
                # 在/usr/local/share/mysql下面有5个my-xxxx.cnf文件:
                #my-small.cnf        最小配置安装,内存<=64M,数据数量最少
                #my-large.cnf        内存=512M
                #my-medium.cnf       32M<内存<64M,或者内存有128M,但是数据库与web服务器公用内存
                #my-huge.cnf        1G<内存<2G,服务器主要运行mysql
                #my-innodb-heavy-4G.cnf  最大配置安装,内存至少4G
                # 我们这是测试环境就没必要弄个太大的了,找最小的吧
                #把my.cnf放在/etc目录下是mysql默认的查找位置
                #cp /usr/local/share/mysql/my-small.cnf /etc/my.cnf
               
                #在这里我把my.cnf放在另外一个位置
                cp /usr/local/share/mysql/my-small.cnf /usr/data0/mysql/3306/my.cnf
                #添加以下内容:
                [mysqld]
                user    = mysql
                port    =3306
                datadir = /usr/local/data0/mysql/3306/data
                log-error = /usr/local/data0/mysql/3306/mysql_error.log
                pid-file = /usr/local/data0/mysql/3306/mysql.pid
                log-slave-updates
                log-bin = /usr/local/data0/mysql/3306/binlog/binlog
                relay-log-index = /usr/local/data0/mysql/3306/relaylog/relaylog
                relay-log-info-file = /usr/local/data0/mysql/3306/relaylog/relaylog
                relay-log = /usr/local/data0/mysql/3306/relaylog/relaylog
    8.6    创建管理MySQL数据库的shell脚本
                vim /usr/local/data0/mysql/3306/mysql           
                #输入以下内容(这里的用户名admin和密码12345678接下来的步骤会创建)
                   
                    #!/bin/sh

                    mysql_port=3306
                    mysql_username="admin"
                    mysql_password="12345678"
                   
                    function_start_mysql()
                    {
                        printf "Starting MySQL...\n"
                        /bin/sh /usr/local/bin/mysqld_safe --defaults-file=/usr/local/data0/mysql/${mysql_port}/my.cnf 2>&1 > /dev/null &
                    }
                   
                    function_stop_mysql()
                    {
                        printf "Stoping MySQL...\n"
                        /usr/local/bin/mysqladmin -u ${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown
                    }
                   
                    function_restart_mysql()
                    {
                        printf "Restarting MySQL...\n"
                        function_stop_mysql
                        sleep 5
                        function_start_mysql
                    }
                   
                    function_kill_mysql()//这一段在freebsd下报错 待修改
                    {
                        kill -9 $(ps -ef &#124; grep 'bin/mysqld_safe' &#124; grep ${mysql_port} &#124; awk '{printf $2}')
                        kill -9 $(ps -ef &#124; grep 'libexec/mysqld' &#124; grep ${mysql_port} &#124; awk '{printf $2}')
                    }
                   
                    if [ "$1" = "start" ]; then
                        function_start_mysql
                    elif [ "$1" = "stop" ]; then
                        function_stop_mysql
                    elif [ "$1" = "restart" ]; then
                    function_restart_mysql
                    elif [ "$1" = "kill" ]; then
                    function_kill_mysql
                    else
                        printf "Usage: /data0/mysql/${mysql_port}/mysql {start&#124;stop&#124;restart&#124;kill}\n"
                    fi
    8.7    赋予shell脚本可执行权限   
                    chmod +x /usr/data0/mysql/3306/mysql
    8.8    启动MySQL
                    /usr/data0/mysql/3306/mysql start
    8.9 通过命令行登录管理MySQL服务器(提示输入密码时直接回车)
                    #注意直接用mysql命令(不跟-u root等参数)也能进入控制台,但是无法执行8.10步操作,报ERROR 1045 (28000)错误
                    /usr/local/bin/mysql -u root -p -S /tmp/mysql.sock
    8.10 输入以下SQL语句,创建一个具有root权限的用户(admin)和密码(12345678)
                    GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' IDENTIFIED BY '12345678';
                    GRANT ALL PRIVILEGES ON *.* TO 'admin'@'127.0.0.1' IDENTIFIED BY '12345678';
    8.11设置随机启动
                    vi /etc/rc.conf 加入下列
                    mysql_enable=”YES”
9 安装php
    9.1 编译安装(fastcgi)
        cd /usr/ports/lang/php52
        make install clean
        #安装过程中需要配置信息如下,使用fastcgi模式
        #FPM是fastcgi进程管理工具需安装
        [X] CLI        Build CLI version                                       
    [X] CGI        Build CGI version                                       
    [ ] APACHE     Build Apache module                                     
    [ ] DEBUG      Enable debug                                             
    [X] SUHOSIN    Enable Suhosin protection system (not for jails)           
    [X] MULTIBYTE  Enable zend multibyte support                           
    [X] IPV6       Enable ipv6 support                                     
    [X] MAILHEAD   Enable mail header patch                                 
    [ ] REDIRECT   Enable force-cgi-redirect support (CGI only)             
    [ ] DISCARD    Enable discard-path support (CGI only)                   
    [X] FASTCGI    Enable fastcgi support (CGI only)                       
    [X] FPM        Enable fastcgi process manager (CGI only)               
    [X] PATHINFO   Enable path-info-check support (CGI only)
    9.2配置php-fpm
        #php-fpm是为PHP打的一个FastCGI管理补丁,可以平滑变更php.ini配置而无需重启php-cgi
        vim /usr/local/etc/php-fpm.conf
        #如果您安装 Nginx + PHP 用于程序调试,请将以下的<value name="display_errors">0</value>改为<value name="display_errors">1</value>,以便显示PHP错误信息,否则,Nginx 会报状态为500的空白错误页
        #如需修改参考下面配置信息:
                <?xml version="1.0" ?>
                <configuration>
               
                  All relative paths in this config are relative to php's install prefix
               
                  <section name="global_options">
               
                    Pid file
                    <value name="pid_file">/usr/local/webserver/php/logs/php-fpm.pid</value>
               
                    Error log file
                    <value name="error_log">/usr/local/webserver/php/logs/php-fpm.log</value>
               
                    Log level
                    <value name="log_level">notice</value>
               
                    When this amount of php processes exited with SIGSEGV or SIGBUS ...
                    <value name="emergency_restart_threshold">10</value>
               
                    ... in a less than this interval of time, a graceful restart will be initiated.
                    Useful to work around accidental curruptions in accelerator's shared memory.
                    <value name="emergency_restart_interval">1m</value>
               
                    Time limit on waiting child's reaction on signals from master
                    <value name="process_control_timeout">5s</value>
               
                    Set to 'no' to debug fpm
                    <value name="daemonize">yes</value>
               
                  </section>
               
                  <workers>
               
                    <section name="pool">
               
                      Name of pool. Used in logs and stats.
                      <value name="name">default</value>
               
                      Address to accept fastcgi requests on.
                      Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
                      <value name="listen_address">127.0.0.1:9000</value>
               
                      <value name="listen_options">
               
                        Set listen(2) backlog
                        <value name="backlog">-1</value>
               
                        Set permissions for unix socket, if one used.
                        In Linux read/write permissions must be set in order to allow connections from web server.
                        Many BSD-derrived systems allow connections regardless of permissions.
                        <value name="owner"></value>
                        <value name="group"></value>
                        <value name="mode">0666</value>
                      </value>
               
                      Additional php.ini defines, specific to this pool of workers.
                      <value name="php_defines">
                        <value name="sendmail_path">/usr/sbin/sendmail -t -i</value>
                        <value name="display_errors">0</value>
                      </value>
               
                      Unix user of processes
                      <value name="user">www</value>
               
                      Unix group of processes
                      <value name="group">www</value>
               
                      Process manager settings
                      <value name="pm">
               
                        Sets style of controling worker process count.
                        Valid values are 'static' and 'apache-like'
                        <value name="style">static</value>
               
                        Sets the limit on the number of simultaneous requests that will be served.
                        Equivalent to Apache MaxClients directive.
                        Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
                        Used with any pm_style.
                        <value name="max_children">128</value>
               
                        Settings group for 'apache-like' pm style
                        <value name="apache_like">
               
                          Sets the number of server processes created on startup.
                          Used only when 'apache-like' pm_style is selected
                          <value name="StartServers">20</value>
               
                          Sets the desired minimum number of idle server processes.
                          Used only when 'apache-like' pm_style is selected
                          <value name="MinSpareServers">5</value>
               
                          Sets the desired maximum number of idle server processes.
                          Used only when 'apache-like' pm_style is selected
                          <value name="MaxSpareServers">35</value>
               
                        </value>
               
                      </value>
               
                      The timeout (in seconds) for serving a single request after which the worker process will be terminated
                      Should be used when 'max_execution_time' ini option does not stop script execution for some reason
                      '0s' means 'off'
                      <value name="request_terminate_timeout">0s</value>
               
                      The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
                      '0s' means 'off'
                      <value name="request_slowlog_timeout">0s</value>
               
                      The log file for slow requests
                      <value name="slowlog">logs/slow.log</value>
               
                      Set open file desc rlimit
                      <value name="rlimit_files">65535</value>
               
                      Set max core size rlimit
                      <value name="rlimit_core">0</value>
               
                      Chroot to this directory at the start, absolute path
                      <value name="chroot"></value>
               
                      Chdir to this directory at the start, absolute path
                      <value name="chdir"></value>
               
                      Redirect workers' stdout and stderr into main error log.
                      If not set, they will be redirected to /dev/null, according to FastCGI specs
                      <value name="catch_workers_output">yes</value>
               
                      How much requests each process should execute before respawn.
                      Useful to work around memory leaks in 3rd party libraries.
                      For endless request processing please specify 0
                      Equivalent to PHP_FCGI_MAX_REQUESTS
                      <value name="max_requests">1024</value>
               
                      Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
                      Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
                      Makes sense only with AF_INET listening socket.
                      <value name="allowed_clients">127.0.0.1</value>
               
                      Pass environment variables like LD_LIBRARY_PATH
                      All $VARIABLEs are taken from current environment
                      <value name="environment">
                        <value name="HOSTNAME">$HOSTNAME</value>
                        <value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
                        <value name="TMP">/tmp</value>
                        <value name="TMPDIR">/tmp</value>
                        <value name="TEMP">/tmp</value>
                        <value name="OSTYPE">$OSTYPE</value>
                        <value name="MACHTYPE">$MACHTYPE</value>
                        <value name="MALLOC_CHECK_">2</value>
                      </value>
               
                    </section>
               
                  </workers>
               
                </configuration>
               
    9.3 启动php-fpm
            #此命令在/usr/local/etc/rc.d/ 目录下
            php-fpm start
            #start|stop|quit|restart|reload|logrotate,修改php.ini后不重启php-cgi,重新加载配置文件使用reload
            #log文件位置/var/log/php-fpm/php-fpm.log   
    9.4设置随机启动
                    vi /etc/rc.conf 加入下列
                    php_fpm_enable=”YES”           
10 安装php-extensions
        10.1编译安装
            cd /usr/ports/lang/php52-extensions
            make install clean
            #安装过程中会出现配置信息
            #去掉ming,firebird,record,imap和cgi选项
            #安装完成后php-extensions设定档在/usr/local/etc/php/extensions.ini中
            #如果安装recode,必須將其放在extensions.ini此檔第一行, 否則無法啟動php-cgi
            #recode与IMAP有冲突只能注释掉一个,否则启动时报Segmentation fault: 11 (core dumped)错误
11 安装nginx
        11.1编译安装
            cd /usr/ports/www/nginx
            make install clean
            #安装过程中出现配置信息
            #选择http_stub_status_module,http_ssl_module
            #安装完成 默认的程序目录是/usr/local/www/nginx/ 可以在配置文件中修改
        11.2创建nginx日志目录
            mkdir -p /usr/local/data1/logs
            chmod +w /usr/local/data1/logs
            chown -R www:www /usr/local/data1/logs
        11.3修改nginx配置文件
            #文件位置在/usr/local/etc/nginx/nginx.conf
            #按照如下内容修改
            #在freebsd下不要用增加fcgi.conf文件
                user  www www;

                worker_processes 8;
               
                error_log  /usr/local/data1/logs/nginx_error.log  crit;
               
                #pid        /usr/local/webserver/nginx/nginx.pid;
               
                #Specifies the value for maximum file descriptors that can be opened by this process.
                worker_rlimit_nofile 65535;
               
                events
                {
                  #use epoll; #linux下使用
                  use kqueue; #freebsd下使用
                  worker_connections 65535;
                }
               
                http
                {
                  include       mime.types;
                  default_type  application/octet-stream;
               
                  #charset  gb2312;
                     
                  server_names_hash_bucket_size 128;
                  client_header_buffer_size 32k;
                  large_client_header_buffers 4 32k;
                  client_max_body_size 8m;
                     
                  sendfile on;
                  tcp_nopush     on;
               
                  keepalive_timeout 60;
               
                  tcp_nodelay on;
               
                  fastcgi_connect_timeout 300;
                  fastcgi_send_timeout 300;
                  fastcgi_read_timeout 300;
                  fastcgi_buffer_size 64k;
                  fastcgi_buffers 4 64k;
                  fastcgi_busy_buffers_size 128k;
                  fastcgi_temp_file_write_size 128k;
               
                  gzip on;
                  gzip_min_length  1k;
                  gzip_buffers     4 16k;
                  gzip_http_version 1.0;
                  gzip_comp_level 2;
                  gzip_types       text/plain application/x-javascript text/css application/xml;
                  gzip_vary on;
               
                  #limit_zone  crawler  $binary_remote_addr  10m;
               
                  server
                  {
                    listen       80;
                    server_name  blog.s135.com;
                    index index.html index.htm index.php;
                    root  /usr/local/www;
               
                    #limit_conn   crawler  20;   
                   
                    #设置drupal7URL重写
                    location / {
                            if (!-e $request_filename) {
                            rewrite ^/(.*)$ /index.php?q=$1 last;
                            }
                        }
                                               
                    location ~ .*\.(php|php5)?$
                    {     
                      #fastcgi_pass  unix:/tmp/php-cgi.sock;
                      fastcgi_pass  127.0.0.1:9000;
                      fastcgi_index index.php;
                      include fcgi.conf;
                    }
                   
                    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                    {
                      expires      30d;
                    }
               
                    location ~ .*\.(js|css)?$
                    {
                      expires      1h;
                    }   
               
                    log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
                              '$status $body_bytes_sent "$http_referer" '
                              '"$http_user_agent" $http_x_forwarded_for';
                    access_log  /usr/local/data1/logs/access.log  access;
                  }
               
                  server
                  {
                    listen       80;
                    server_name  www.s135.com;
                    index index.html index.htm index.php;
                    root  /data0/htdocs/www;
               
                    location ~ .*\.(php|php5)?$
                    {     
                      #fastcgi_pass  unix:/tmp/php-cgi.sock;
                      fastcgi_pass  127.0.0.1:9000;
                      fastcgi_index index.php;
                      include fcgi.conf;
                    }
               
                    log_format  wwwlogs  '$remote_addr - $remote_user [$time_local] "$request" '
                               '$status $body_bytes_sent "$http_referer" '
                               '"$http_user_agent" $http_x_forwarded_for';
                    access_log  /data1/logs/wwwlogs.log  wwwlogs;
                  }
               
                  server
                  {
                    listen  80;
                    server_name  status.blog.s135.com;
               
                    location / {
                    stub_status on;
                    access_log   off;
                    }
                  }
                  server {
 52         listen       80;
 53         server_name  drupal7.h189.com;
 54         index index.html index.htm index.php;
 55         root  /usr/local/www/drupal7;
 56
 57         #charset koi8-r;
 58
 59         #access_log  logs/host.access.log  main;
 60
 61         location / {
 62             if (!-e $request_filename) {
 63                 rewrite ^/(.*)$ /index.php?q=$1 last;
 64             }
 65         }
 66
 67         #error_page  404              /404.html;
 68
 69         # redirect server error pages to the static page /50x.html
 70         #
 71         error_page   500 502 503 504  /50x.html;
 72         location = /50x.html {
 73             root   /usr/local/www/nginx-dist;
 74         }
 75
 76         # proxy the PHP scripts to Apache listening on 127.0.0.1:80
 77         #
 78         #location ~ \.php$ {
 79         #    proxy_pass   http://127.0.0.1;
 80         #}
 81
 82         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 83         #
 84         location ~.*\.(php|php5)?$ {
 85             #root           /usr/local/www/drupal7;
 86             fastcgi_pass   127.0.0.1:9000;
 87             fastcgi_index  index.php;
 88             fastcgi_param  SCRIPT_FILENAME  /usr/local/www/drupal7$fastcgi_script_name;
 89             include        fastcgi_params;
 90         }
 91
 92         # deny access to .htaccess files, if Apache's document root
 93         # concurs with nginx's one
 94         #
 95         #location ~ /\.ht {
 96         #    deny  all;
 97         #}
 98         log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
 99                             '$status $body_bytes_sent "$http_referer" '
100                             '"$http_user_agent" $http_x_forwarded_for';
101         access_log  /usr/local/data1/logs/access.log  access;
102     }
103
104     server
105     {
106         listen 80;
107         server_name  phpmyadmin211.h189.com;
108         index index.html index.htm index.php;
109         root  /usr/local/www/phpMyAdmin211;
110         location ~ \.php$ {
111             root           /usr/local/www/drupal;
112             fastcgi_pass   127.0.0.1:9000;
113             fastcgi_index  index.php;
114             fastcgi_param  SCRIPT_FILENAME  /usr/local/www/phpMyAdmin211$fastcgi_script_name;
115             include        fastcgi_params;
116         }
117     }
118
119     server
120     {
121         listen 80;
122         server_name  www.mysite.com;
123         index index.html index.htm index.php;
124         root  /usr/local/www/mysite;
125         location ~.*\.(php|php5)?$ {
126             root           /usr/local/www/mysite;
127             fastcgi_pass   127.0.0.1:9000;
128             fastcgi_index  index.php;
129             fastcgi_param  SCRIPT_FILENAME  /usr/local/www/mysite$fastcgi_script_name;
130             include        fastcgi_params;
131         }
132
133         log_format  mysite  '$remote_addr - $remote_user [$time_local] "$request" '
134                             '$status $body_bytes_sent "$http_referer" '
135                             '"$http_user_agent" $http_x_forwarded_for';
136         access_log  /usr/local/data1/logs/mysite.log  mysite;
137     }
138
139     server
140     {
141         listen 80;
142         server_name drupal6.h189.com;
143         index index.html index.htm index.php;
144         root  /usr/local/www/drupal6;
145         location ~.*\.(php|php5)?$ {
146             root           /usr/local/www/drupal6;
147             fastcgi_pass   127.0.0.1:9000;
148             fastcgi_index  index.php;
149             fastcgi_param  SCRIPT_FILENAME  /usr/local/www/drupal6$fastcgi_script_name;
150             include        fastcgi_params;
151         }
152
153         location / {
154             if (!-e $request_filename) {
155                 rewrite ^/(.*)$ /index.php?q=$1 last;
156             }
157         }
158        
159         log_format  drupal6  '$remote_addr - $remote_user [$time_local] "$request" '
160                             '$status $body_bytes_sent "$http_referer" '
161                             '"$http_user_agent" $http_x_forwarded_for';
162         access_log  /usr/local/data1/logs/drupal6.log  drupal6;
163     }
            }
        11.4 Nginx常用命令
            #启动
            nginx
            #修改了nginx.conf配置文件后执行下面命令检查配置文件是否正确
            nginx -t
            #平滑启动
            nginx -s reload
            #默认日志位置:/var/log/nginx-error.log
        11.5常见错误
            11.5.1 No inputfile specified错误
                        修改/usr/local/etc/nginx/nginx.conf中的:
                        fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
                        为:
                        fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx$fastcgi_script_name;
                       
                        /usr/local/www/nginx就是nginx的root所处路径。
        11.6设置随机启动
                    vi /etc/rc.conf 加入下列
                    nginx_enable=”YES”               
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
                       
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/bin/mysqladmin -u root password 'new-password'
/usr/local/bin/mysqladmin -u root -h h189.com password 'new-password'

Alternatively you can run:
/usr/local/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local ; /usr/local/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/bin/mysqlbug script!

猜你喜欢

转载自elite527.iteye.com/blog/867677