Acfe 发表于 2018-11-10 08:38:48

nginx-091

  环境
  libevent-1.4.14b-stable.tar.gz
  libiconv-1.13.1.tar.gz
  mysql-5.1.46-linux-i686-glibc23.tar.gz
  nginx-1.1.2.tar.gz
  pcre-8.12.zip
  php-5.3.3.tar.bz2
  
  编译环境
  # yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel ssse2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
  
  安装mysql
  # tar -zxvf mysql-5.1.46-linux-i686-glibc23.tar.gz -C /usr/local/
  # mv mysql-5.1.46-linux-i686-glibc23/ mysql
  # cd /usr/local/
  # groupadd -r mysql
  # useradd -r -g mysql -s /sbin/nologin -M mysql
  # cd /usr/local/mysql/
  # scripts/mysql_install_db --user=mysql
  # chown -R root .
  # chown -R mysql data
  # cp support-files/my-medium.cnf /etc/my.cnf
  # cp support-files/mysql.server /etc/init.d/mysqld
  # vim /etc/ld.so.conf.d/mysql.conf
  /usr/local/mysql/lib
  # ldconfig -v |grep mysql
  /usr/local/mysql/lib:
  libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
  libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
  # cd /usr/include/
  # ln -s /usr/local/mysql/include/ mysql
  # service mysqld start
  # chkconfig --add mysqld
  # chkconifg mysqld on
  -bash: chkconifg: command not found
  # vim /etc/profile
  # /etc/profile
  PATH=$PATH:/usr/local/mysql/bin
  # ./etc/profile
  
  # mysql
  mysql> \q
  Bye
  
  NgiNx的安装:
  首先需要安装支持nginx的模块
  # tar -zxvf libevent-1.4.14b-stable.tar.gz -C /usr/local
  # cd /usr/local/libevent-1.4.14b-stable/
  # ./configure --prefix=/usr/local/
  #make && make install
  
  # tar -zxvf libiconv-1.13.1.tar.gz -C /usr/local/
  # cd /usr/local/libiconv-1.13.1/
  # ./configure --prefix=/usr/local
  # make &&make install
  
  # unzip pcre-8.12.zip
  # chmod 777 -R pcre-8.12
  # cd pcre-8.12
  # ./configure --prefix=/usr/local
  # make && make install
  
  解压nginx包创建用户组
  # tar -zxvf nginx-1.1.2.tar.gz -C /usr/src
  # cd /usr/src
  # mv nginx-1.1.2/ nginx
  # cd nginx/
  # mkdir logs
  # groupadd www
  # useradd -g www wwww
  编译安装niginx
  # ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx --conf-path=/usr/local/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log   --pid-path=/usr/local/nginx/logs/nginx.pid    --lock-path=/var/lock/nginx.lock   --user=wwww--group=www--with-http_ssl_module--with-http_flv_module   --with-http_stub_status_module   --with-http_gzip_static_module   --http-client-body-temp-path=/var/tmp/nginx/client/   --http-proxy-temp-path=/var/tmp/nginx/proxy/   --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/   --with-pcre
  # make && make install
  make: warning:Clock skew detected.Your build may be incomplete.
  make: Leaving directory `/usr/src/nginx'
  
  
  # ./nginx
  nginx: mkdir() "/var/tmp/nginx/client/" failed (2: No such file or directory)
  # mkdir -p /var/tmp/nginx/client
  # ./nginx                               //启动nginx
  # links http://localhost
  Welcome to nginx!
  Welcome to nginx!
  # vim
  . /etc/rc.d/init.d/functions
  . /etc/sysconfig/network
  nginx="/usr/local/nginx/nginx"
  编辑nginx服务启动脚本
  # chmod +x /etc/init.d/nginxd
  # service nginxd restart
  nginx: the configuration file /usr/local/nginx.conf syntax is ok
  nginx: configuration file /usr/local/nginx.conf test is successful
  Stopping nginx:                                          
  Starting nginx:                                          
  
  
  安装php
  # tar -jxvf php-5.3.3.tar.bz2 -C /usr/local
  # cd /usr/local/
  # mv php-5.3.3/ php
  # cd php/
  # ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --enable-fpm --with-libevent-dir=/usr/local --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-iconv-dir=/usr/local
  
  #make
  /usr/local/php/ext/iconv/iconv.c:2466: undefined reference to `libiconv_open'
  collect2: ld returned 1 exit status
  make: *** Error 1
  //不为php加入iconv模块
  #make ZEND_EXTRA_LIBS='-liconv'
  # make install
  
  
  # cp php.ini-development /usr/local/php/lib
  lib/   libs/    libtool
  # cp php.ini-development /usr/local/php/lib/php.ini
  # cd /usr/local/php/etc
  # cp php-fpm.conf.default php-fpm.conf
  # vim php-fpm.conf
  
  
  # /usr/local/php/sbin/php-fpm
  Aug 23 22:24:29.551045 pm.min_spare_servers(0) must be a positive value
  Aug 23 22:24:29.553583 failed to post process the configuration
  # vim php-fpm.conf
  
  pid = /usr/local/php/var/run/php-fpm.pid
  error_log = /usr/local/php/var/log/php-fpm.log
  log_level = notice
  
  listen = 127.0.0.1:9000
  user = nobody
  group = nobody
  pm = dynamic
  pm.max_children = 50
  pm.start_servers = 20
  pm.min_spare_servers = 5
  pm.max_spare_servers = 35
  # /usr/local/php/sbin/php-fpm
  
  
  # vim nginx.conf
  server {
  listen       80;
  server_namelocalhost;
  location / {
  root   html;
  indexindex.php index.html index.htm;
  }
  error_page   500 502 503 504/50x.html;
  location = /50x.html {
  root   html;
  }
  location ~ \.php$ {
  root         html;
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_indexindex.php;
  fastcgi_paramSCRIPT_FILENAME/usr/local/nginx/html$fastcgi_script_name;
  include      fastcgi_params;
  }
  # service nginxd restart
  nginx: the configuration file /usr/local/nginx.conf syntax is ok
  nginx: configuration file /usr/local/nginx.conf test is successful
  Stopping nginx:                                          
  Starting nginx:                                          
  # links http://127.0.0.1
  phpinfo() (1/26)
  PHP Logo
  PHP Version 5.3.3
  # vim index.php
  
  # links http://localhost
  http://localhost/
  connect!

页: [1]
查看完整版本: nginx-091