0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

干货:Centos 6.5部署nginx和php环境部署

如意 来源:百家号 作者: 互联网资深ops专家 2020-06-28 10:00 次阅读

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‘

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

[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

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • PHP
    PHP
    +关注

    关注

    0

    文章

    452

    浏览量

    26452
  • nginx
    +关注

    关注

    0

    文章

    135

    浏览量

    11984
  • CentOS
    +关注

    关注

    0

    文章

    75

    浏览量

    13625
收藏 人收藏

    评论

    相关推荐

    云服务器的linux中如何搭建php运行环境

    要在云服务器的Linux系统上搭建PHP运行环境,您可以按照以下步骤进行: 1、安装PHP: 使用包管理工具(如apt、yum等)安装PHP及其相关模块。例如,在Ubuntu系统上,您
    的头像 发表于 03-21 17:08 144次阅读

    Linux 基于centos7 在局域网内部署的可组态大数据展示平台

    E-Control基于centos7 在局域网内部署的可组态大数据展示平台,通过浏览器操作组态工具、浏览组态画面,实现工程管理、组态编辑、工业设备采集以及组态运行三大功能。采用标准HTML5技术
    发表于 02-25 00:26

    请问可以私有部署

    有没有插件或者私有部署的服务
    发表于 02-01 16:00

    php运行环境的配置步骤

    PHP是一种广泛使用的服务器端脚本语言,被用来开发Web应用程序。为了在计算机上运行PHP代码,我们需要配置PHP运行环境。本文将详细介绍PHP
    的头像 发表于 12-04 15:27 529次阅读

    php运行环境本地测试地址是

    如何搭建PHP运行环境、常用的PHP测试工具和一些常见问题的解决方案,以帮助读者快速有效地搭建自己的PHP本地测试环境。 一、搭建
    的头像 发表于 12-04 15:25 286次阅读

    php运行环境的搭建方法

    搭建PHP运行环境是开发PHP应用程序的基础,本文将详尽、详实、细致地介绍从零开始搭建PHP运行环境的方法,包括选择操作系统、安装Web服务
    的头像 发表于 12-04 14:56 501次阅读

    怎么下载centos镜像文件

    CentOS 是一个基于 Linux 的操作系统,它是一种稳定、强大且易于使用的发行版。CentOS 镜像文件是用于安装和部署 CentOS 操作系统的文件。在本文中,我们将详细介绍如
    的头像 发表于 11-23 10:48 502次阅读

    linux docker安装部署

    Docker是一种开源的容器化平台,可以帮助开发者在不同的环境中快速构建、测试和部署应用程序。它能够解决不同操作系统之间的兼容性问题,简化了应用程序的部署过程,并提供了高效的资源利用。本文将带您详细
    的头像 发表于 11-23 09:27 435次阅读

    CentOS7中使用一键脚本部署Librenms网络监控系统

    今天在CentOS7下使用一键脚本部署Librenms网络监控系统。
    的头像 发表于 09-14 09:27 444次阅读
    <b class='flag-5'>CentOS</b>7中使用一键脚本<b class='flag-5'>部署</b>Librenms网络监控系统

    【KV260视觉入门套件试用体验】KV260部署yolov3实现车辆和行人检测

    KV260-yolov3部署已知KV260官方中提供的四个智能检测已经实现了两个,其余两个根据个人兴趣进行部署即可这里不做相关的说明。需要提前说明的是通过uboot引导加载的是ubuntu的系统
    发表于 08-08 14:29

    如何用cubeai部署颜色识别?

    应该怎么样用cubeai部署颜色识别?
    发表于 08-05 07:09

    如何在RDKx3部署docker镜像?

    一种在RDKx3部署docker镜像跑tros历程的方法 为了保持主系统环境干净整洁,有在docker中部署代码的习惯。 docker pull ningcong/rdkx3:v0.1 在资源中心
    发表于 08-02 11:02

    Linux开发_CentOS7.4服务器搭建NFS、NGINX服务器,安装ffmpeg、Qt环境

    CentOS7.4服务器版本的环境下搭建NFS服务器、安装ffmpeg、安装nginx服务器、部署Qt编译环境
    的头像 发表于 07-14 13:45 923次阅读
    Linux开发_<b class='flag-5'>CentOS</b>7.4服务器搭建NFS、<b class='flag-5'>NGINX</b>服务器,安装ffmpeg、Qt<b class='flag-5'>环境</b>

    Nginx搭建流行架构LNMP的步骤

    LNMP是一套技术的组合,L=Linux、N=Nginx、M=MySQL(MyriDB)、P=PHP(Python)
    的头像 发表于 05-22 18:19 698次阅读
    <b class='flag-5'>Nginx</b>搭建流行架构LNMP的步骤

    Nginx常用的配置和基本功能讲解

    Nginx 已经广泛应用于 J-one 和 Jdos 的环境部署上,本文对 Nginx 的常用的配置和基本功能进行讲解,适合 Nginx
    的头像 发表于 05-04 10:25 410次阅读