CentOS5安装Nginx1.4+PHP5.5 FastCGI

转载链接:http://blog.csdn.net/staricqxyz/article/details/17012329


  1. yum -y install 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 gettext-devel libXpm-devel libtool libevent libevent-devel gd-devel gd libmcrypt libmcrypt-devel pcre pcre-devel  
  1. [root@lnmp software]# tar zxvf libiconv-1.14.tar.gz   
  2. [root@lnmp software]# cd libiconv-1.14  
  3. [root@lnmp libiconv-1.14]# ./configure --prefix=/service/libiconv  
  4. [root@lnmp libiconv-1.14]# make && make install  
  1. [root@lnmp software]# tar zxvf GD-2.50.tar.gz   
  2. [root@lnmp software]# cd GD-2.50     
  3. [root@lnmp GD-2.50]# perl Makefile.PL   
  4. [root@lnmp GD-2.50]# make && make install  

安装MySQL

  1. [root@lnmp software]# tar zxvf mysql-5.5.34.tar.gz   
  2. [root@lnmp software]# cd mysql-5.5.34  
  3. [root@lnmp mysql-5.5.34]# groupadd mysql  
  4. [root@lnmp mysql-5.5.34]# useradd -g mysql -s /sbin/nologin mysql  
  5. [root@lnmp mysql-5.5.34]# cmake . -DCMAKE_INSTALL_PREFIX=/service/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/service/mysql -DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_EXAMPLE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=30307 -DCOMPILATION_COMMENT=ZWC -DWITH_DEBUG=0  
  6. [root@lnmp mysql-5.5.34]# make && make install  
  7. [root@lnmp mysql-5.5.34]# cp support-files/my-large.cnf /service/mysql/my.cnf  
  8. [root@lnmp mysql-5.5.34]# chown -R mysql:mysql /data/mysql /service/mysql  
  9. [root@lnmp mysql-5.5.34]# /service/mysql/bin/mysqld_safe --defaults-file=/service/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql &  


安装PHP,PHP5.5中自带了mysqlnd,MySQL不是必须安装的

  1. [root@lnmp software]# tar zxvf php-5.5.6.tar.gz   
  2. [root@lnmp software]# cd php-5.5.6  
  3. [root@lnmp php-5.5.6]# groupadd webroot  
  4. [root@lnmp php-5.5.6]# useradd -g webroot -s /sbin/nologin webroot  
  5. [root@lnmp php-5.5.6]# ./configure --prefix=/service/php --with-config-file-path=/service/php/etc --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-jpeg-dir --with-png-dir --with-freetype-dir --with-mcrypt --with-zlib-dir --with-xpm-dir --enable-xml --with-curl --with-zlib --enable-exif --with-zlib-dir --with-bz2 --with-libxml-dir --enable-mbstring --enable-sockets --enable-zip --enable-ftp --with-iconv-dir=/service/libiconv --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --with-fpm-user=webroot --with-fpm-group=webroot  --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --with-libdir=lib64  
  6. [root@lnmp php-5.5.6]# make && make install  
  7. Installing shared extensions:     /service/php/lib/php/extensions/no-debug-non-zts-20121212/  
  8. Installing PHP CLI binary:        /service/php/bin/  
  9. Installing PHP CLI man page:      /service/php/php/man/man1/  
  10. Installing PHP FPM binary:        /service/php/sbin/  
  11. Installing PHP FPM config:        /service/php/etc/  
  12. Installing PHP FPM man page:      /service/php/php/man/man8/  
  13. Installing PHP FPM status page:      /service/php/php/fpm/  
  14. Installing PHP CGI binary:        /service/php/bin/  
  15. Installing PHP CGI man page:      /service/php/php/man/man1/  
  16. Installing build environment:     /service/php/lib/php/build/  
  17. Installing header files:          /service/php/include/php/  
  18. Installing helper programs:       /service/php/bin/  
  19.   program: phpize  
  20.   program: php-config  
  21. Installing man pages:             /service/php/php/man/man1/  
  22.   page: phpize.1  
  23.   page: php-config.1  
  24. Installing PEAR environment:      /service/php/lib/php/  
  25. [PEAR] Archive_Tar    - installed: 1.3.11  
  26. [PEAR] Console_Getopt - installed: 1.3.1  
  27. warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.4)  
  28. warning: pear/PEAR requires package "pear/XML_Util" (recommended version 1.2.1)  
  29. [PEAR] PEAR           - installed: 1.9.4  
  30. Wrote PEAR system config file at: /service/php/etc/pear.conf  
  31. You may want to add: /service/php/lib/php to your php.ini include_path  
  32. [PEAR] Structures_Graph- installed: 1.0.4  
  33. [PEAR] XML_Util       - installed: 1.2.1  
  34. /service/software/php-5.5.6/build/shtool install -c ext/phar/phar.phar /service/php/bin  
  35. ln -s -f /service/php/bin/phar.phar /service/php/bin/phar  
  36. Installing PDO headers:          /service/php/include/php/ext/pdo/  
  37. [root@lnmp php-5.5.6]# cp php.ini-production /service/php/etc/php.ini  
  38. [root@lnmp php-5.5.6]# cp /service/php/etc/php-fpm.conf.default /service/php/etc/php-fpm.conf  
  39. [root@lnmp php-5.5.6]# /service/php/sbin/php-fpm  
  40. [root@lnmp php-5.5.6]# netstat -lanp|grep php-fpm  
  41. tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      5483/php-fpm.conf)    
  42. unix  3      [ ]         STREAM     CONNECTED     459737 5483/php-fpm.conf)    
  43. unix  3      [ ]         STREAM     CONNECTED     459736 5483/php-fpm.conf)    
  44. [root@lnmp php-5.5.6]# ps -ef|grep php  
  45. root      5483     1  0 23:19 ?        00:00:00 php-fpm: master process (/service/php/etc/php-fpm.conf)  
  46. webroot   5484  5483  0 23:19 ?        00:00:00 php-fpm: pool www          
  47. webroot   5485  5483  0 23:19 ?        00:00:00 php-fpm: pool www          
  48. root      5497 24209  0 23:21 pts/0    00:00:00 grep php  

安装nginx
  1. [root@lnmp software]# tar zxvf nginx-1.4.4.tar.gz   
  2. [root@lnmp software]# cd nginx-1.4.4  
  3. [root@lnmp nginx-1.4.4]# ./configure --prefix=/service/nginx --with-http_ssl_module --with-pcre --with-http_spdy_module --with-http_stub_status_module --with-pcre --user=webroot --group=webroot  
  4. ........................  
  5. Configuration summary  
  6.   + using system PCRE library  
  7.   + using system OpenSSL library  
  8.   + md5: using OpenSSL library  
  9.   + sha1: using OpenSSL library  
  10.   + using system zlib library  
  11.   
  12.   nginx path prefix: "/service/nginx"  
  13.   nginx binary file: "/service/nginx/sbin/nginx"  
  14.   nginx configuration prefix: "/service/nginx/conf"  
  15.   nginx configuration file: "/service/nginx/conf/nginx.conf"  
  16.   nginx pid file: "/service/nginx/logs/nginx.pid"  
  17.   nginx error log file: "/service/nginx/logs/error.log"  
  18.   nginx http access log file: "/service/nginx/logs/access.log"  
  19.   nginx http client request body temporary files: "client_body_temp"  
  20.   nginx http proxy temporary files: "proxy_temp"  
  21.   nginx http fastcgi temporary files: "fastcgi_temp"  
  22.   nginx http uwsgi temporary files: "uwsgi_temp"  
  23.   nginx http scgi temporary files: "scgi_temp"  
  24.   
  25. [root@lnmp nginx-1.4.4]# make && make install  
配置nginx
  1. [root@lnmp conf]# cat /service/nginx/conf/nginx.conf  
  2. user  webroot webroot;  
  3. worker_processes  1;  
  4.   
  5. events {  
  6.     worker_connections  1024;  
  7. }  
  8.   
  9.   
  10. http {  
  11.     include       mime.types;  
  12.     default_type  application/octet-stream;  
  13.   
  14.     sendfile        on;  
  15.   
  16.     keepalive_timeout  65;  
  17.   
  18.   
  19.     server {  
  20.         listen       80;  
  21.         server_name  localhost;  
  22.         index index.php index.html index.shtml index.htm;  
  23.         root /service/nginx/html;  
  24.   
  25.         location / {  
  26.         try_files $uri $uri/ /index.php?$args;  
  27.         }  
  28.           
  29.         location ~ .*\.(php)?$  
  30.         {  
  31.         expires -1s;  
  32.         try_files $uri =404;  
  33.         fastcgi_split_path_info ^(.+\.php)(/.+)$;  
  34.         include fastcgi_params;  
  35.         fastcgi_param PATH_INFO $fastcgi_path_info;  
  36.         fastcgi_index index.php;  
  37.         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
  38.         fastcgi_pass 127.0.0.1:9000;  
  39.         #fastcgi_pass unix:/var/run/phpfpm.sock;  
  40.         #php-fpm.conf listen = /var/run/phpfpm.sock##  
  41.         }  
  42.   
  43.         error_page   500 502 503 504  /50x.html;  
  44.         location = /50x.html {  
  45.             root   html;  
  46.         }  
  47.   
  48.   
  49.   
  50.     }  
  51.   
  52. }  
  53. [root@lnmp conf]# /service/nginx/sbin/nginx -t  
  54. nginx: the configuration file /service/nginx/conf/nginx.conf syntax is ok  
  55. nginx: configuration file /service/nginx/conf/nginx.conf test is successful  
启动nginx
  1. [root@lnmp conf]# /service/nginx/sbin/nginx  
  2. [root@lnmp conf]# netstat -lanp|grep nginx  
  3. tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      9867/nginx            
  4. unix  3      [ ]         STREAM     CONNECTED     465408 9867/nginx            
  5. unix  3      [ ]         STREAM     CONNECTED     465407 9867/nginx      




本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/276389.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

FTP服务器的搭建

IIS IIS所提供的FTP功能比较简单: 用户依赖于“操作系统用户”;只提供了全局读(浏览和复制)、写(删除、修改、添加)功能设置,也就是说所有的读写权限都相同;“用户”与“对应目录”的…

一份热乎乎的滴滴前端面经

关注若川视野,回复"pdf" 领取资料,回复"加群",可加群长期交流学习滴滴前端实习面经滴滴是我投简历之后第二家面试的公司, 国庆节前两三天投的简历, 国庆后复工第一天就给我打了电话约一面。那时候…

用webBrowser取源文件取不到的点击数--选秀榜selectop.com网站内容管理系统之六

用idhttp可以取到源文件,但网站用脚本代码,源文件是看不到,并且代码的结果也取不出。webBrowser可以多次返回下载到的内容,不包括任何html语法,这个当中就有文章的点击数。在WebBrowser1DownloadComplete事件中处理&am…

Nginx负载均衡配置

转载链接:http://blog.csdn.net/staricqxyz/article/details/16984029 将域名指向Nginx服务器 访问www.test.com会转发到192.168.1.22,192.168.1.23 user nobody nobody; worker_processes 1; events { worker_connections 1024; } http { …

linux查看python环境变量_Linux中添加PYTHONPATH配置anaconda环境变量方法

因为最近开发多智能体模型需要把自己写的环境打包import,环境是统一的,如果不加入环境变量,每次测一个算法都要把包作为附属脚本和算法脚本放一起非常麻烦。所以就想把这些写的环境加入到python的环境变量里,这样就不用每次测试都…

yii_wiki_145_yii-cjuidialog-for-create-new-model (通过CJuiDialog来创建新的Model)

/**** CJuiDialog for create new model http://www.yiiframework.com/wiki/145/cjuidialog-for-create-new-model/translated by php攻城师http://blog.csdn.net/phpgcsIntroduction Scenario Preparation of the form Enhance the action create The dialog Summary ***/Intr…

真诚推荐几个最值得关注的前端公众号

前端技术日新月异,发展迅速,作为一个与时俱进的前端工程师,需要不断的学习。这里强烈推荐几个前端开发工程师必备的优质公众号,希望对你有所帮助。大家可以像我一样,利用碎片时间阅读这些公众号的文章。code秘密花园一…

Silverlight Unit Test Framework

微软在08年的时候推出了一个Silverlight的单元测试框架,该框架在Mix 08的时候与Silverlight controls同时推出的,微软工程师Jeff Wilcox一直参与维护该单元测试框架。Scott Gu对这个框架的介绍Jeff Wilcox提供的视频介绍该框架的源代码已经包括在Silverl…

Nginx 反向代理、负载均衡、页面缓存、URL重写及读写分离详解

转载链接:http://freeloda.blog.51cto.com/2033581/1288553 大纲 一、前言 二、环境准备 三、安装与配置Nginx 四、Nginx之反向代理 五、Nginx之负载均衡 六、Nginx之页面缓存 七、Nginx之URL重写 八、Nginx之读写分离 注,操作系统为 CentOS 6.4 x86_64…

[Jobdu] 题目1499:项目安排

题目描述:小明每天都在开源社区上做项目,假设每天他都有很多项目可以选,其中每个项目都有一个开始时间和截止时间,假设做完每个项目后,拿到报酬都是不同的。由于小明马上就要硕士毕业了,面临着买房、买车、…

How to: Display a Gradient Fill

To display a gradient fill 第一步:In Visual Studio, create a Smart Device project. 第二部:Add the Gradientfill and GradientFilledButton classes to your project. public sealed class GradientFill{ // This method wraps the …

能在任意一种框架中复用的组件,太牛了!

Web Component 是一种 W3C标准支持的组件化方案,通过它可以编写可复用的组件,同时也可以对自己的组件做更精细化的控制。更牛的是,Web Component 可以在任何一种框架中使用,不用加载任何模块、代码量小,优势非常明显&a…

stm32cubemx中文_用 STM32 通用定时器做微秒延时函数(STM32CubeMX版本)

概述​ 在使用 DHT11 的时候,时序通信需要微秒来操作,STM32CubeMX 自带一个系统时钟,但是实现的是毫秒级别的。因此就自己用通用计时器实现一个。文章目录环境:开发板:STM32F4探索者(正点原子)1…

MySQL索引类型一览 让MySQL高效运行起来

转载链接:http://database.51cto.com/art/200910/156685.htm 索引是快速搜索的关键。MySQL索引的建立对于MySQL的高效运行是很重要的。下面介绍几种常见的MySQL索引类型。 在数据库表中,对字段建立索引可以大大提高查询速度。假如我们创建了一个 mytabl…

431.chapter2.configure database mail

SQL Database Mail SQL 2005数据库邮件是一种通过 Microsoft SQL Server 2005 Database Engine 发送电子邮件的企业解决方案。通过使用数据库邮件,数据库应用程序可以向用户发送电子邮件。邮件中可以包含查询结果,还可以包含来自网络中任何资源的文件。数…

人脸识别拷勤门禁主板_捷易讲解AI无感人脸识别考勤门禁终端设备在使用中的维护方法...

人脸识别考勤门禁终端设备虽然在出厂时,都有做密封处理,但面对细小的灰尘,并没有做到百分百防尘。灰尘对于AI无感人脸识别考勤门禁终端设备是有一定的影响的,他会沉淀在主板上、屏幕上,影响设备散热和正常工作&#xf…

【翻译】How-To: Using the N* Stack, part 3

原文地址:http://jasondentler.com/blog/2009/08/how-to-using-the-n-stack-part-3/ Java – 一种代码松散的XML 在我们学习 Fluent NHibernate 之前, 应该先了解下老式的 NHibernate 映射文件应该是怎样写的。 在一个典型的 NHibernate 配置中,你会有很…

你可能需要的网易前端三轮面经

关注若川视野, 回复"pdf" 领取资料,回复"加群",可加群长期交流前言最近一个星期面了几家公司,最后收获了心仪的网易有道offer,于是推掉了其他的面试,至于一些其他大厂,并没有投简历&am…

PHP yii 框架源码阅读(一)

转载链接:http://www.th7.cn/Program/php/2012/04/03/67983.shtml 目录文件 |- framework 框架核心库 |-|- base 底层类库文件夹,包 含CApplication(应用类,负责全局的用户请求处理,它管理的应用组件集,将提供特定功…

复习.net/c#时的小文章之万年草稿版 (全是基础概念,请懂的人绕行)

必读文:61条面向对象设计的经验原则(体会篇) C#知识点集合 (面试必备)一、显式(explicit)转换和隐式(implicit)转换的一般概念int i 100; Response.Write(i); // 这就是隐式 Response.Write(i.ToString()); // 这就是显式 一般来讲&#xff…