编程技术分享平台

网站首页 > 技术教程 正文

Centos 6.5部署nginx+php环境部署

xnh888 2024-09-26 00:08:24 技术教程 24 ℃ 0 评论

1.IP地址:192.168.1.241

下载这次部署需要的更新包,并上传到/usr/local/src目录:[root@binds src]# ll

total 17576

-rw-r--r-- 1 root root 730589 Jul 14 13:29 nginx-1.2.8.tar.gz

-rw-r--r-- 1 root root 1790055 Jul 29 10:39 pcre-8.32.tar.gz

-rw-r--r-- 1 root root 14902187 Jul 28 18:00 php-5.3.22.tar.gz

-rw-r--r-- 1 root root 560351 Jul 29 10:41 zlib-1.2.7.tar.gz

安装nginx必须安装pcre-8.32.tar.gz

[root@binds pcre-8.32]# tar zxvf pcre-8.32.tar.gz

[root@binds pcre-8.32]# cd pcre-8.32

[root@binds pcre-8.32]# ./configure

[root@binds pcre-8.32]# make && make install

make[3]: Leaving directory `/usr/local/src/pcre-8.32'

make[2]: Leaving directory `/usr/local/src/pcre-8.32'

make[1]: Leaving directory `/usr/local/src/pcre-8.32'

安装结束

接下来安装

[root@binds src]# tar zxvf zlib-1.2.7.tar.gz

[root@binds src]# cd zlib-1.2.7

[root@binds zlib-1.2.7]# ./configure

出现错误Looking for a four-byte integer type... Found. 无关紧要

[root@localhost zlib-1.2.7]# make && make install

chmod 644 /usr/local/lib/libz.a

cp libz.so.1.2.7 /usr/local/lib

chmod 755 /usr/local/lib/libz.so.1.2.7

cp zlib.3 /usr/local/share/man/man3

chmod 644 /usr/local/share/man/man3/zlib.3

cp zlib.pc /usr/local/lib/pkgconfig

chmod 644 /usr/local/lib/pkgconfig/zlib.pc

cp zlib.h zconf.h /usr/local/include

chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h

安装结束

安装完成后,安装nginx

[root@binds src]# tar zxvf nginx-1.2.8.tar.gz

[root@binds src]# cd nginx-1.2.8

./configure --prefix=/usr/local/nginx-1.2.8 --with-http_sub_module --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module


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: "/usr/local/nginx-1.2.8"

nginx binary file: "/usr/local/nginx-1.2.8/sbin/nginx"

nginx configuration prefix: "/usr/local/nginx-1.2.8/conf"

nginx configuration file: "/usr/local/nginx-1.2.8/conf/nginx.conf"

nginx pid file: "/usr/local/nginx-1.2.8/logs/nginx.pid"

nginx error log file: "/usr/local/nginx-1.2.8/logs/error.log"

nginx http access log file: "/usr/local/nginx-1.2.8/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"


[root@binds nginx-1.2.8]# make && make install

cp conf/nginx.conf '/usr/local/nginx-1.2.8/conf/nginx.conf.default'

test -d '/usr/local/nginx-1.2.8/logs' || mkdir -p '/usr/local/nginx-1.2.8/logs'

test -d '/usr/local/nginx-1.2.8/logs' || mkdir -p '/usr/local/nginx-1.2.8/logs'

test -d '/usr/local/nginx-1.2.8/html' || cp -R html '/usr/local/nginx-1.2.8'

test -d '/usr/local/nginx-1.2.8/logs' || mkdir -p '/usr/local/nginx-1.2.8/logs'

make[1]: Leaving directory `/usr/local/src/nginx-1.2.8'

安装完成

打补丁:后面会补全的

root@binds nginx-1.2.8]# service iptables stop

iptables: Setting chains to policy ACCEPT: filter [ OK ]

iptables: Flushing firewall rules: [ OK ]

iptables: Unloading modules: [ OK ]

[root@binds nginx-1.2.8]#

[root@localhost nginx-1.2.8]# /usr/local/nginx-1.2.8/sbin/nginx

/usr/local/nginx-1.2.8/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

报错解决方法:

创建软连接:[root@binds share]#测试下:ln -s /usr/local/lib/libpcre.so.1 /lib64/



接下来继续安装php

mkdir -p /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626

[root@binds share]# cd /usr/local/src/

[root@binds src]# ll

total 17592

drwxr-xr-x 9 1001 1001 4096 Aug 10 10:58 nginx-1.2.8

-rw-r--r-- 1 root root 730589 Jul 14 13:29 nginx-1.2.8.tar.gz

drwxr-xr-x 9 1169 1169 12288 Aug 10 10:34 pcre-8.32

-rw-r--r-- 1 root root 1790055 Jul 29 10:39 pcre-8.32.tar.gz

-rw-r--r-- 1 root root 14902187 Jul 28 18:00 php-5.3.22.tar.gz

drwxr-xr-x 14 501 games 4096 Aug 10 10:52 zlib-1.2.7

-rw-r--r-- 1 root root 560351 Jul 29 10:41 zlib-1.2.7.tar.gz

[root@binds src]# tar zxvf php-5.3.22.tar.gz

[root@binds php-5.3.22]# yum -y install 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 e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gd curl curl-devel mysql mysql-devel mhash libiconv mcrypt


./configure "--prefix=/usr/local/php" "--enable-fpm" "--with-config-file-path=/home/server_config/php" "--with-mysql=/usr/local/mysql" "--with-mysqli=/usr/local/mysql/bin/mysql_config" "--with-pdo-mysql=/usr/local/mysql" "--with-iconv-dir" "--with-freetype-dir" "--with-jpeg-dir" "--with-png-dir" "--with-gd" "--with-zlib" "--with-libxml-dir" "--with-curl" "--with-curlwrappers" "--with-openssl" "--with-mhash" "--with-xmlrpc" "--with-mcrypt" "--with-ldap" "--with-ldap-sasl" "--enable-xml" "--enable-safe-mode" "--enable-bcmath" "--enable-shmop" "--enable-sysvsem" "--enable-inline-optimization" "--enable-mbregex" "--enable-mbstring" "--enable-gd-native-ttf" "--enable-ftp" "--enable-pcntl" "--enable-sockets" "--enable-fastcgi"


低版本:./configure --prefix=/usr/local/php \
--with-config-file-path=/home/server_config/php\
--with-mysql=/usr/local/mysql/ \
--with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local/ \
--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr/ \
--enable-xml --disable-rpath --enable-discard-path --enable-bcmath \
--enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers \
--enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring \
--with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl \
--enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap
--enable-safe-mode

可能报错:

checking for LDAP Cyrus SASL support... yes

configure: error: Cannot find ldap libraries in /usr/lib.

执行:cp -frp /usr/lib64/libldap* /usr/lib

checking for mcrypt support... yes

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

上传libmcrypt-2.5.8.tar.gz

# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure
# make
# make install


checking for specified location of the MySQL UNIX socket... no configure: error: Cannot find libmysq

执行:

cp -rp /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so

[root@localhost php-5.3.22]# make && make install

/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

如果需要mcrypt,那么需要安装libltdl

libltdl在libmcrypt软件包中就有,具体过程:

#cd /software/libmcrypt-2.5.8/libltdl

#./configure –enable-ltdl-install

#make

#make install

[root@localhost php-5.3.22]# cp php.

php.gif php.ini-development php.ini-production

[root@localhost php-5.3.22]# cp php.ini-development /usr/local/php-5.3.22/lib/

[root@localhost php-5.3.22]# cp php.ini-production /usr/local/php-5.3.22/lib/

[root@localhost php-5.3.22]# cd /usr/local/php-5.3.22/

[root@localhost php-5.3.22]# ll

total 32

drwxr-xr-x 2 root root 4096 Aug 11 18:16 bin

drwxr-xr-x 2 root root 4096 Aug 11 18:16 etc

drwxr-xr-x 3 root root 4096 Aug 11 18:16 include

drwxr-xr-x 3 root root 4096 Aug 11 18:18 lib

drwxr-xr-x 4 root root 4096 Aug 11 18:15 man

drwxr-xr-x 2 root root 4096 Aug 11 18:15 sbin

drwxr-xr-x 3 root root 4096 Aug 11 18:15 share

drwxr-xr-x 4 root root 4096 Aug 11 18:15 var

[root@localhost php-5.3.22]# cd etc/

[root@localhost etc]# ll

total 28

-rw-r--r-- 1 root root 1222 Aug 11 18:16 pear.conf

-rw-r--r-- 1 root root 21680 Aug 11 18:15 php-fpm.conf.default

[root@localhost etc]# mv php-fpm.conf.default php-fpm.conf

[root@localhost etc]# /usr/local/php-5.3.22/sbin/php-fpm

第三方php apc apcu的安装

上传APC-3.1.9.tgz apcu-4.0.6.tgz到服务器

tar zxvf APC-3.1.9.tgz

[root@localhost APC-3.1.9]# /usr/local/php/bin/phpize

[root@localhost src]# tar zxvf apcu-4.0.6.tgz

[root@localhost apcu-4.0.6]# /usr/local/php/bin/phpize

./configure --enable-apcu --with-php-config=/usr/local/php/bin/php-config

./configure --prefix=/usr/local/unixODBC-2.3.0 --includedir=/usr/local/include --libdir=/usr/lib -bindir=/usr/bin --sysconfdir=/etc

安装imagick-3.1.0RC2 先yum -y install ImageMagick-devel

创建登陆账号:

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表