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

    文章

    463

    浏览量

    28806
  • nginx
    +关注

    关注

    0

    文章

    194

    浏览量

    13210
  • CentOS
    +关注

    关注

    0

    文章

    85

    浏览量

    14838
收藏 人收藏
加入交流群
微信小助手二维码

扫码添加小助手

加入工程师交流群

    评论

    相关推荐
    热点推荐

    matlab的算法部署在simulink中

    有没有哪位大佬能提供一下思路,遇到一个问题matlab得不到神经网络fitcnet模型的权重参数,所以simulink没办法部署,那遇到这种情况该如何处理
    发表于 12-08 15:27

    RA8P1部署ai模型指南:从训练模型到部署 | 本周六

    部署人脸检测模型。11月22日(本周六),900,我们将就嵌入式AI,带来免费线上培训,手把手带你掌握包括本文但不限于本文的更多技术干货,还有双核通信培训哦!带上
    的头像 发表于 11-20 18:06 2412次阅读
    RA8P1<b class='flag-5'>部署</b>ai模型指南:从训练模型到<b class='flag-5'>部署</b> | 本周六

    如何快速在云服务器上部署Web环境

    如何快速在云服务器上部署Web环境
    的头像 发表于 10-14 14:16 863次阅读

    米尔RK3576部署端侧多模态多轮对话,6TOPS算力驱动30亿参数LLM

    流程 2.1 依赖环境 2.2 一键编译 2.3 端侧部署步骤 三、效果展示:图文多轮问答 四、二次开发与拓展方向 五、结论与未来发展方向 一、引言1.1 什么是多轮对话?多轮对
    发表于 09-05 17:25

    求助,关于nanoEdgeAI部署在keil5出现的问题求解

    为什么用NanoEdgeAI Studio训练好的库用keil5部署到我的STM32H750的单片机上时它生成的neai_classification函数输入的值是变的但输出值是定值0.268941和0.731059换模型也是这样
    发表于 08-13 07:32

    CentOS 7下MySQL 8双主热备高可用架构全解

    Centos7部署MySQL8+keepalived双主热备(含Keepalived配置与GTID同步优化方案) 架构拓扑原理 GTID同步 VIP 192.168.1.100 MySQL主节点1
    的头像 发表于 08-12 17:08 987次阅读

    求助,关于K230部署yolov8时遇到问题求解

    使用yolov8训练出来了一个十个类别的模型并且按照要求转换成了.kmodel模型,在部署到K230时 使用yolo大作战里面的代码提示我list out of range但是我看了我的.yaml
    发表于 08-12 07:26

    Ansible Playbook自动化部署Nginx集群指南

    面对日益猖獗的DDoS攻击,手动部署防护已经out了!今天教你用Ansible一键部署具备DDoS防御能力的Nginx集群,让攻击者哭着回家!
    的头像 发表于 08-06 17:54 916次阅读

    AICube生成部署文件失败的原因?怎么解决?

    我按照网上的方法安装了dotnet,和AICube,并且我是安装在非中文路径,但是尝试了一天了,都不能成功的生成部署文件,我使用软件自带的样例,但是就是不能生成部署文件 期待结果和实际结果 环境路径 ! image.png
    发表于 08-05 06:26

    什么是 K8S,如何使用 K8S

    和回滚。 Service:为 Pod 提供稳定的访问入口,支持负载均衡。 Namespace:逻辑隔离机制,用于划分资源域。 二、如何使用 K8S 安装与部署 环境要求: 操作系统:CentOS
    发表于 06-25 06:45

    Nginx配置终极指南

    Nginx 是开源、高性能、高可靠的 Web 和反向代理服务器,而且支持热部署,几乎可以做到 7 * 24 小时不间断运行,即使运行几个月也不需要重新启动,还能在不间断服务的情况下对软件版本进行热
    的头像 发表于 06-18 15:56 1212次阅读
    <b class='flag-5'>Nginx</b>配置终极指南

    云原生环境Nginx的故障排查思路

    本文聚焦于云原生环境Nginx的故障排查思路。随着云原生技术的广泛应用,Nginx作为常用的高性能Web服务器和反向代理服务器,在容器化和编排的环境中面临着新的故障场景和挑战。
    的头像 发表于 06-17 13:53 1165次阅读
    云原生<b class='flag-5'>环境</b>里<b class='flag-5'>Nginx</b>的故障排查思路

    如何使用Docker部署大模型

    随着深度学习和大模型的快速发展,如何高效地部署这些模型成为了一个重要的挑战。Docker 作为一种轻量级的容器化技术,能够将模型及其依赖环境打包成一个可移植的容器,极大地简化了部署流程。本文将详细介绍如何使用 Docker
    的头像 发表于 05-24 16:39 1349次阅读

    HarmonyOS5云服务技术分享--Serverless抽奖模板部署

    提前准备一个二级域名(后面托管要用) 二、部署模板四曲 1️⃣ ​​模板选择​​ 进入AGC控制台 → 云开发 → Serverless模板 在模板市场找到\"抽奖活动模板\"
    发表于 05-22 20:25

    如何在CentOS系统中部署ELK日志分析系统

    功能,使用户能够快速获取关键业务洞察。本文将详细介绍如何在 CentOS 系统中部署 ELK 日志分析系统,
    的头像 发表于 05-08 11:47 1167次阅读
    如何在<b class='flag-5'>CentOS</b>系统中<b class='flag-5'>部署</b>ELK日志分析系统