设为首页 收藏本站
查看: 471|回复: 0

[经验分享] nginx-091

[复制链接]

尚未签到

发表于 2018-11-10 08:38:48 | 显示全部楼层 |阅读模式
  环境
  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
  
  编译环境
  [root@localhost ~]# 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 glib2  glib2-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
  [root@localhost local]# tar -zxvf mysql-5.1.46-linux-i686-glibc23.tar.gz -C /usr/local/
  [root@localhost local]# mv mysql-5.1.46-linux-i686-glibc23/ mysql
  [root@localhost local]# cd /usr/local/
  [root@localhost ~]# groupadd -r mysql
  [root@localhost ~]# useradd -r -g mysql -s /sbin/nologin -M mysql
  [root@localhost ~]# cd /usr/local/mysql/
  [root@localhost mysql]# scripts/mysql_install_db --user=mysql
  [root@localhost mysql]# chown -R root .
  [root@localhost mysql]# chown -R mysql data
  [root@localhost mysql]# cp support-files/my-medium.cnf /etc/my.cnf
  [root@localhost mysql]# cp support-files/mysql.server /etc/init.d/mysqld
  [root@localhost ~]# vim /etc/ld.so.conf.d/mysql.conf
  /usr/local/mysql/lib
  [root@localhost ~]# 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
  [root@localhost ~]# cd /usr/include/
  [root@localhost include]# ln -s /usr/local/mysql/include/ mysql
  [root@localhost include]# service mysqld start
  [root@localhost include]# chkconfig --add mysqld
  [root@localhost include]# chkconifg mysqld on
  -bash: chkconifg: command not found
  [root@localhost include]# vim /etc/profile
  # /etc/profile
  PATH=$PATH:/usr/local/mysql/bin
  [root@localhost include]# ./etc/profile
  
  [root@localhost etc]# mysql
  mysql> \q
  Bye
  
  NgiNx的安装:
  首先需要安装支持nginx的模块
  [root@localhost libevent-1.4.14b-stable]# tar -zxvf libevent-1.4.14b-stable.tar.gz -C /usr/local
  [root@localhost libevent-1.4.14b-stable]# cd /usr/local/libevent-1.4.14b-stable/
  [root@localhost libevent-1.4.14b-stable]# ./configure --prefix=/usr/local/
  [root@localhost libevent-1.4.14b-stable]#make && make install
  
  [root@localhost libiconv-1.13.1]# tar -zxvf libiconv-1.13.1.tar.gz -C /usr/local/
  [root@localhost libiconv-1.13.1]# cd /usr/local/libiconv-1.13.1/
  [root@localhost libiconv-1.13.1]# ./configure --prefix=/usr/local
  [root@localhost libiconv-1.13.1]# make &&make install
  
  [root@localhost ~]# unzip pcre-8.12.zip
  [root@localhost ~]# chmod 777 -R pcre-8.12
  [root@localhost ~]# cd pcre-8.12
  [root@localhost pcre-8.12]# ./configure --prefix=/usr/local
  [root@localhost pcre-8.12]# make && make install
  
  解压nginx包创建用户组
  [root@localhost nginx]# tar -zxvf nginx-1.1.2.tar.gz -C /usr/src
  [root@localhost ~]# cd /usr/src
  [root@localhost src]# mv nginx-1.1.2/ nginx
  [root@localhost src]# cd nginx/
  [root@localhost nginx]# mkdir logs
  [root@localhost nginx]# groupadd www
  [root@localhost nginx]# useradd -g www wwww
  编译安装niginx
  [root@localhost nginx]# ./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
  [root@localhost nginx]# make && make install
  make[1]: warning:  Clock skew detected.  Your build may be incomplete.
  make[1]: Leaving directory `/usr/src/nginx'
  
  
  [root@localhost nginx]# ./nginx
  nginx: [emerg] mkdir() "/var/tmp/nginx/client/" failed (2: No such file or directory)
  [root@localhost nginx]# mkdir -p /var/tmp/nginx/client
  [root@localhost nginx]# ./nginx                               //启动nginx
  [root@localhost nginx]# links http://localhost
  Welcome to nginx!
  Welcome to nginx!
  [root@localhost contrib]# vim
  . /etc/rc.d/init.d/functions
  . /etc/sysconfig/network
  nginx="/usr/local/nginx/nginx"
  编辑nginx服务启动脚本
  [root@localhost contrib]# chmod +x /etc/init.d/nginxd
  [root@localhost local]# 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:                                            [  OK  ]
  Starting nginx:                                            [  OK  ]
  
  
  安装php
  [root@localhost local]# tar -jxvf php-5.3.3.tar.bz2 -C /usr/local
  [root@localhost local]# cd /usr/local/
  [root@localhost php]# mv php-5.3.3/ php
  [root@localhost php]# cd php/
  [root@localhost 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
  
  [root@localhost php]#  make
  /usr/local/php/ext/iconv/iconv.c:2466: undefined reference to `libiconv_open'
  collect2: ld returned 1 exit status
  make: *** [sapi/fpm/php-fpm] Error 1
  //不为php加入iconv模块
  [root@localhost php]#  make ZEND_EXTRA_LIBS='-liconv'
  [root@localhost php]# make install
  
  
  [root@localhost php]# cp php.ini-development /usr/local/php/lib
  lib/     libs/    libtool
  [root@localhost php]# cp php.ini-development /usr/local/php/lib/php.ini
  [root@localhost php]# cd /usr/local/php/etc
  [root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
  [root@localhost etc]# vim php-fpm.conf
  
  
  [root@localhost etc]# /usr/local/php/sbin/php-fpm
  Aug 23 22:24:29.551045 [ALERT] [pool www] pm.min_spare_servers(0) must be a positive value
  Aug 23 22:24:29.553583 [ERROR] failed to post process the configuration
  [root@localhost etc]# vim php-fpm.conf
  [global]
  pid = /usr/local/php/var/run/php-fpm.pid
  error_log = /usr/local/php/var/log/php-fpm.log
  log_level = notice
  [www]
  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
  [root@localhost etc]# /usr/local/php/sbin/php-fpm
  
  
  [root@localhost local]# vim nginx.conf
  server {
  listen       80;
  server_name  localhost;
  location / {
  root   html;
  index  index.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_index  index.php;
  fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;
  include        fastcgi_params;
  }
  [root@localhost local]# 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:                                            [  OK  ]
  Starting nginx:                                            [  OK  ]
  [root@localhost local]# links http://127.0.0.1
  phpinfo() (1/26)
  PHP Logo
  PHP Version 5.3.3
  [root@localhost html]# vim index.php
  
  [root@localhost html]# links http://localhost
  http://localhost/
  connect!


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-633071-1-1.html 上篇帖子: nginx基础应用 下篇帖子: nginx 499 502 413 404 处理。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表