阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

在Linux系统中对LNMP源代码安装后添加php和nginx模块

106次阅读
没有评论

共计 2628 个字符,预计需要花费 7 分钟才能阅读完成。

在工作生产中以前的同事搭建了 LNMP 环境,可是在安装的过程中发现有好多 php 和 nginx 的模块没有安装, 现在如果全部重新安装怕服务器不稳定,所以只有一个一个的添加没有安装的模块了。今天我就给大家演示一下如何添加没有安装的模块,希望对大家有帮助。

 1. 首先安装 LNMP 环境
请参考: http://www.linuxidc.com/Linux/2013-12/93941.htm
 2. 安装 php 没有安装的模块
[root@RedHat1 php-5.3.27]# cd ext/mbstring/      – 进入模块的目录
[root@redhat1 mbstring]# /usr/local/php-5.3.27/bin/phpize  – 生成配置文件
Configuring for:
PHP Api Version:        20090626
Zend Module Api No:      20090626
Zend Extension Api No:  220090626
[root@redhat1 mbstring]# make  – 编译
[root@redhat1 mbstring]# cp -a modules/mbstring.so /usr/local/php-5.3.27/ext/    – 自己当前目录下 modules 有一个模块复制到 php 的安装目录中去
[root@redhat1 mbstring]# cd /usr/local/php-5.3.27/ext/
[root@redhat1 ext]# ll
total 2896
-rwxr-xr-x. 1 root root 2965328 Dec 12 10:30 mbstring.so
[root@redhat1 ext]# vim ../etc/php.ini    – 打开 php 配置文件添加以下两行
extension_dir = “/usr/local/php-5.3.27/ext/”
extension=mbstring.so

3. 测试安装是否成功

在 Linux 系统中对 LNMP 源代码安装后添加 php 和 nginx 模块

4. 安装 nginx 没有安装的模块
[root@redhat1 sbin]# ./nginx -V    – 查看 nginx 安装模块的信息
nginx version: nginx/1.3.13
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
configure arguments: –prefix=/usr/local/nginx –with-pcre=/usr/local/pcre/ –with-openssl=/usr/local/openssl/ –without-http_upstream_ip_hash_module –without-http_upstream_least_conn_module –without-http_upstream_keepalive_module –with-http_stub_status_module –add-module=/home/samba/ngx_cache_purge-2.1
[root@redhat1 sbin]# cd /home/samba/nginx-1.3.13
[root@redhat1 nginx-1.3.13]# ./configure –help |grep rewrite
–without-http_rewrite_module      disable ngx_http_rewrite_module
[root@redhat1 nginx-1.3.13]# ./configure –without-http_rewrite_module
[root@redhat1 nginx-1.3.13]# make            – 编译源代码
[root@redhat1 nginx-1.3.13]# echo $?        – 是否出错
0
[root@redhat1 nginx-1.3.13]# ll objs/      – 以下有一个新的 nginx 服务
total 2676
-rw-r–r–. 1 root root  35818 Dec 12 11:27 Makefile
drwxr-xr-x. 3 root root    4096 Dec  2 14:01 addon
-rw-r–r–. 1 root root  13979 Dec 12 11:27 autoconf.err
-rwxr-xr-x. 1 root root 2630916 Dec 12 11:28 nginx
-rw-r–r–. 1 root root    5253 Dec 12 11:28 nginx.8
-rw-r–r–. 1 root root    5613 Dec 12 11:27 ngx_auto_config.h
-rw-r–r–. 1 root root    657 Dec 12 11:27 ngx_auto_headers.h
-rw-r–r–. 1 root root    3586 Dec 12 11:27 ngx_modules.c
-rw-r–r–. 1 root root  20444 Dec 12 11:28 ngx_modules.o
drwxr-xr-x. 8 root root    4096 Dec  2 09:36 src
[root@redhat1 nginx-1.3.13]# mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old1
[root@redhat1 nginx-1.3.13]# cp -a objs/nginx /usr/local/nginx/sbin/  – 新 nginx 服务替换老的 nginx
[root@redhat1 nginx-1.3.13]# cd /usr/local/nginx/sbin/
[root@redhat1 sbin]# ll
total 7984
-rwxr-xr-x. 1 root  root  2630916 Dec 12 11:28 nginx
-rwxr-xr-x. 1 nginx nginx 2748622 Dec  2 13:12 nginx.old
-rwxr-xr-x. 1 nginx nginx 2788770 Dec  2 14:01 nginx.old1
[root@redhat1 sbin]# ./nginx -V  – 查看只有一个模块了
nginx version: nginx/1.3.13
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
configure arguments: –without-http_rewrite_module

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-20发表,共计2628字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中