设为首页 收藏本站
查看: 1117|回复: 3

[经验分享] CentOS5安装Nginx1.4+PHP5.5 FastCGI

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2013-11-29 09:14:01 | 显示全部楼层 |阅读模式
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  
[iyunv@lnmp software]# tar zxvf libiconv-1.14.tar.gz   
[iyunv@lnmp software]# cd libiconv-1.14  
[iyunv@lnmp libiconv-1.14]# ./configure --prefix=/service/libiconv  
[iyunv@lnmp libiconv-1.14]# make && make install  
[iyunv@lnmp software]# tar zxvf GD-2.50.tar.gz   
[iyunv@lnmp software]# cd GD-2.50     
[iyunv@lnmp GD-2.50]# perl Makefile.PL   
[iyunv@lnmp GD-2.50]# make && make install  

安装MySQL
[iyunv@lnmp software]# tar zxvf mysql-5.5.34.tar.gz   
[iyunv@lnmp software]# cd mysql-5.5.34  
[iyunv@lnmp mysql-5.5.34]# groupadd mysql  
[iyunv@lnmp mysql-5.5.34]# useradd -g mysql -s /sbin/nologin mysql  
[iyunv@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  
[iyunv@lnmp mysql-5.5.34]# make && make install  
[iyunv@lnmp mysql-5.5.34]# cp support-files/my-large.cnf /service/mysql/my.cnf  
[iyunv@lnmp mysql-5.5.34]# chown -R mysql:mysql /data/mysql /service/mysql  
[iyunv@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不是必须安装的
[iyunv@lnmp software]# tar zxvf php-5.5.6.tar.gz   
[iyunv@lnmp software]# cd php-5.5.6  
[iyunv@lnmp php-5.5.6]# groupadd webroot  
[iyunv@lnmp php-5.5.6]# useradd -g webroot -s /sbin/nologin webroot  
[iyunv@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  
[iyunv@lnmp php-5.5.6]# make && make install  
Installing shared extensions:     /service/php/lib/php/extensions/no-debug-non-zts-20121212/  
Installing PHP CLI binary:        /service/php/bin/  
Installing PHP CLI man page:      /service/php/php/man/man1/  
Installing PHP FPM binary:        /service/php/sbin/  
Installing PHP FPM config:        /service/php/etc/  
Installing PHP FPM man page:      /service/php/php/man/man8/  
Installing PHP FPM status page:      /service/php/php/fpm/  
Installing PHP CGI binary:        /service/php/bin/  
Installing PHP CGI man page:      /service/php/php/man/man1/  
Installing build environment:     /service/php/lib/php/build/  
Installing header files:          /service/php/include/php/  
Installing helper programs:       /service/php/bin/  
  program: phpize  
  program: php-config  
Installing man pages:             /service/php/php/man/man1/  
  page: phpize.1  
  page: php-config.1  
Installing PEAR environment:      /service/php/lib/php/  
[PEAR] Archive_Tar    - installed: 1.3.11  
[PEAR] Console_Getopt - installed: 1.3.1  
warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.4)  
warning: pear/PEAR requires package "pear/XML_Util" (recommended version 1.2.1)  
[PEAR] PEAR           - installed: 1.9.4  
Wrote PEAR system config file at: /service/php/etc/pear.conf  
You may want to add: /service/php/lib/php to your php.ini include_path  
[PEAR] Structures_Graph- installed: 1.0.4  
[PEAR] XML_Util       - installed: 1.2.1  
/service/software/php-5.5.6/build/shtool install -c ext/phar/phar.phar /service/php/bin  
ln -s -f /service/php/bin/phar.phar /service/php/bin/phar  
Installing PDO headers:          /service/php/include/php/ext/pdo/  
[iyunv@lnmp php-5.5.6]# cp php.ini-production /service/php/etc/php.ini  
[iyunv@lnmp php-5.5.6]# cp /service/php/etc/php-fpm.conf.default /service/php/etc/php-fpm.conf  
[iyunv@lnmp php-5.5.6]# /service/php/sbin/php-fpm  
[iyunv@lnmp php-5.5.6]# netstat -lanp|grep php-fpm  
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      5483/php-fpm.conf)   
unix  3      [ ]         STREAM     CONNECTED     459737 5483/php-fpm.conf)   
unix  3      [ ]         STREAM     CONNECTED     459736 5483/php-fpm.conf)   
[iyunv@lnmp php-5.5.6]# ps -ef|grep php  
root      5483     1  0 23:19 ?        00:00:00 php-fpm: master process (/service/php/etc/php-fpm.conf)  
webroot   5484  5483  0 23:19 ?        00:00:00 php-fpm: pool www         
webroot   5485  5483  0 23:19 ?        00:00:00 php-fpm: pool www         
root      5497 24209  0 23:21 pts/0    00:00:00 grep php  

安装nginx
[iyunv@lnmp software]# tar zxvf nginx-1.4.4.tar.gz   
[iyunv@lnmp software]# cd nginx-1.4.4  
[iyunv@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  
........................  
Configuration summary  
  + using system PCRE library  
  + using system OpenSSL library  
  + md5: using OpenSSL library  
  + sha1: using OpenSSL library  
  + using system zlib library  

  nginx path prefix: "/service/nginx"  
  nginx binary file: "/service/nginx/sbin/nginx"  
  nginx configuration prefix: "/service/nginx/conf"  
  nginx configuration file: "/service/nginx/conf/nginx.conf"  
  nginx pid file: "/service/nginx/logs/nginx.pid"  
  nginx error log file: "/service/nginx/logs/error.log"  
  nginx http access log file: "/service/nginx/logs/access.log"  
  nginx http client request body temporary files: "client_body_temp"  
  nginx http proxy temporary files: "proxy_temp"  
  nginx http fastcgi temporary files: "fastcgi_temp"  
  nginx http uwsgi temporary files: "uwsgi_temp"  
  nginx http scgi temporary files: "scgi_temp"  

[iyunv@lnmp nginx-1.4.4]# make && make install  
配置nginx
[iyunv@lnmp conf]# cat /service/nginx/conf/nginx.conf  
user  webroot webroot;  
worker_processes  1;  

events {  
    worker_connections  1024;  
}  


http {  
    include       mime.types;  
    default_type  application/octet-stream;  

    sendfile        on;  

    keepalive_timeout  65;  


    server {  
        listen       80;  
        server_name  localhost;  
        index index.php index.html index.shtml index.htm;  
        root /service/nginx/html;  

        location / {  
        try_files $uri $uri/ /index.php?$args;  
        }  

        location ~ .*\.(php)?$  
        {  
        expires -1s;  
        try_files $uri =404;  
        fastcgi_split_path_info ^(.+\.php)(/.+)$;  
        include fastcgi_params;  
        fastcgi_param PATH_INFO $fastcgi_path_info;  
        fastcgi_index index.php;  
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
        fastcgi_pass 127.0.0.1:9000;  
        #fastcgi_pass unix:/var/run/phpfpm.sock;  
        #php-fpm.conf listen = /var/run/phpfpm.sock##  
        }  

        error_page   500 502 503 504  /50x.html;  
        location = /50x.html {  
            root   html;  
        }  



    }  

}  
[iyunv@lnmp conf]# /service/nginx/sbin/nginx -t  
nginx: the configuration file /service/nginx/conf/nginx.conf syntax is ok  
nginx: configuration file /service/nginx/conf/nginx.conf test is successful  
启动nginx
[iyunv@lnmp conf]# /service/nginx/sbin/nginx  
[iyunv@lnmp conf]# netstat -lanp|grep nginx  
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      9867/nginx            
unix  3      [ ]         STREAM     CONNECTED     465408 9867/nginx            
unix  3      [ ]         STREAM     CONNECTED     465407 9867/nginx      

Center.jpg
Center.jpg




运维网声明 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.yunweiku.com/thread-10794-1-1.html 上篇帖子: Nginx连接数限制 下篇帖子: linux Nginx 日志脚本

尚未签到

发表于 2013-12-12 12:21:01 | 显示全部楼层
有多少人爱看最近访客,就等待着那个人出现。

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

尚未签到

发表于 2013-12-21 08:34:30 | 显示全部楼层
*—–宝 贝、心 脏 旳(1/2)是 尓

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

尚未签到

发表于 2013-12-27 08:43:07 | 显示全部楼层
别人再好,也是别人。自己再不堪,也是自己,独一无二的自己。

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

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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