前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS 6.4用源代码安装LNMP环境

CentOS 6.4用源代码安装LNMP环境

作者头像
星哥玩云
发布2022-06-28 17:21:24
3270
发布2022-06-28 17:21:24
举报
文章被收录于专栏:开源部署

对于在Linux系统中安装web服务其实都是差不多的,只是软件的选择不一样,不过在php-5.2.17和以前的版本LNMP环境和以后安装有一点区别,就是启用--enable-fastcgi这个模块。现在我用php-5.3.27来搭建LNMP环境,对于搭建不成功的网友们希望给我留言,大家一起解决问题,一起进步。

1.安装Linux系统    --这一步省略

2.安装nginx服务 [root@RedHat1 samba]# tar xvf nginx-1.3.13.tar.gz [root@redhat1 samba]# cd nginx-1.3.13 [root@redhat1 nginx-1.3.13]# ./configure --prefix=/usr/local/nginx  -user=nginx --group=nginx  --with-http_sub_module --with-http_gunzip_module  --without-http_rewrite_module --without-http_proxy_module --without-http_upstream_ip_hash_module [root@redhat1 nginx-1.3.13]# make && make install [root@redhat1 nginx-1.3.13]# echo $? 0 [root@redhat1 nginx-1.3.13]# cd /usr/local/nginx/sbin/ [root@redhat1 sbin]# ./nginx [root@redhat1 sbin]# netstat -an |grep 80 tcp        0      0 0.0.0.0:80                  0.0.0.0:*                  LISTEN [root@redhat1 sbin]#

3.测试nginx服务是否正常启动

2.安装MySQL数据库软件 [root@redhat1 samba]# tar xvf mysql-5.1.51.tar.gz [root@redhat1 samba]# cd mysql-5.1.51 [root@redhat1 mysql-5.1.51]# ./configure --prefix=/usr/local/mysql-5.1 [root@redhat1 mysql-5.1.51]# make && make install [root@redhat1 mysql-5.1.51]# cd /usr/local/mysql-5.1/bin  --进入安装mysql目录 [root@redhat1 bin]# ./mysqld_safe &    --启动数据库 [root@redhat1 bin]# netstat -an | grep 3306    --检查mysql是否启动 tcp        0      0 0.0.0.0:3306                0.0.0.0:*                  LISTEN [root@redhat1 bin]# mysql -u root -p  --登陆数据库,密码为空 Enter password: Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 108 Server version: 5.1.51-log Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and Redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>

3.安装php软件 [root@redhat1 samba]# tar xvf php-5.3.27.tar.gz [root@redhat1 samba]# cd php-5.3.27 [root@redhat1 php-5.3.27]# ./configure --prefix=/usr/local/php-5.3.27 --enable-fpm --with-gd --with-mysql=/usr/local/mysql5.1/ --with-mysqli=/usr/local/mysql5.1/bin/mysql_config  --with-png-dir --with-jpeg-dir  --with-zlib  --with-ldap --with-curl --with-snmp --with-freetype-dir [root@redhat1 php-5.3.27]# make && make install [root@redhat1 php-5.3.27]# cd /usr/local/php-5.3.27/etc/ [root@redhat1 etc]# cp -a php-fpm.conf.default php-fpm.conf [root@redhat1 etc]# cp /home/samba/php-5.3.27/php.ini-development  php.ini

4.nginx和php相接合

[root@redhat1 etc]# cd /usr/local/nginx/conf/

[root@redhat1 conf]# vim nginx.conf    --去掉以下注释

location ~ \.php$ {

root          html;

fastcgi_pass  127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

include        fastcgi_params;

}

[root@redhat1 conf]# vim ../html/index.php    --创建php首页文件

<?php

phpinfo();

?>

5.启动服务,并测试  [root@redhat1 conf]# /usr/local/php-5.3.27/sbin/php-fpm [root@redhat1 conf]# /usr/local/nginx/sbin/nginx [root@redhat1 conf]# netstat -an |more Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address              Foreign Address            State tcp        0      0 127.0.0.1:9000              0.0.0.0:*                  LISTEN tcp        0      0 0.0.0.0:80                  0.0.0.0:*                  LISTEN

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 MySQL
腾讯云数据库 MySQL(TencentDB for MySQL)为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。其具备6大企业级特性,包括企业级定制内核、企业级高可用、企业级高可靠、企业级安全、企业级扩展以及企业级智能运维。通过使用腾讯云数据库 MySQL,可实现分钟级别的数据库部署、弹性扩展以及全自动化的运维管理,不仅经济实惠,而且稳定可靠,易于运维。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档