contos6.5 LNMP安装记录

Posted 大智如蠢

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了contos6.5 LNMP安装记录相关的知识,希望对你有一定的参考价值。

 1 //确定当前系统版本
 2 # cat /etc/redhat-release
 3 //关闭防火墙
 4 # service iptables stop
 5 //永久关闭防火墙
 6 # chkconfig iptables off
 7 //查看防火墙关闭状态
 8 # service iptables status
 9 //安装 wget
10 # yum install wget
11 //配置CentOS 6.0 第三方yum源
12 # wget http://www.atomicorp.com/installers/atomic
13 # sh ./atomic
14 # yum check-update
15 //安装开发包和库文件(注意换行)
16 # yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel
17 //卸载已安装的apache、mysqlphp
18 # yum remove httpd
19 # yum remove mysql
20 # yum remove php
21 //安装nginx
22 # yum install nginx
23 # service nginx start
24 # chkconfig --levels 235 nginx on
25 //设2、3、5级别开机启动
26 //访问服务器域名显示nginx页面
27 //安装mysql
28 # yum install mysql mysql-server mysql-devel
29 # service mysqld start
30 # chkconfig --levels 235 mysqld on
31 //登陆MySQL删除空用户,修改root密码
32 # mysql
33 mysql>select user,host,password from mysql.user;
34 mysql>drop user ‘‘@localhost;
35 mysql>update mysql.user set password = PASSWORD(‘*********‘) where user=‘root‘;
36 mysql>flush privileges;
37 mysql>exit;
38 //安装php(注意换行)
39 yum install php lighttpd-fastcgi php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap
40 //安装php和所需组件使PHP支持MySQL、FastCGI模式
41 # yum install php-tidy php-common php-devel php-fpm php-mysql
42 # service php-fpm start
43 # chkconfig --levels 235 php-fpm on
44 //配置nginx支持php
45 # cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.confbak 
46 //修改nginx配置文件,添加fastcgi支持
47 # vi /etc/nginx/conf.d/default.conf
48 index index.php index.html index.htm;
49 //加入index.php
50 
51 location ~ \.php$ {
52 root html;
53 fastcgi_pass 127.0.0.1:9000;
54 fastcgi_index index.php;
55 
56 #注释里面这一句
57 
58 #加上下面这一句
59 
60 fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
61 include fastcgi_params;
62 }
63 //将以上代码注释去掉,并修改成nginx默认路径
64 //配置php
65 //编辑文件php.ini,大写G跳最后一行,在文件末尾添加cgi.fix_pathinfo = 1
66 # vi /etc/php.ini 
67 //重启nginx php-fpm
68 # service nginx restart
69 # service php-fpm restart
70 //建立info.php文件
71 # vi /usr/share/nginx/html/info.php
72 <?php
73 phpinfo();
74 //测试nginx是否解析php
75 //本地浏览器输入:192.168.1.105/info.php
76 
77 //显示php界面 环境搭建成功

 

以上是关于contos6.5 LNMP安装记录的主要内容,如果未能解决你的问题,请参考以下文章

20200720记录:部署LNMP环境,构建LNMP平台,地址重写

阿里云-centos7.2-LNMP-编译安装-记录

Centos搭建CI持续集成系统环境--部署gerrit环境完整记录

mac lnmp

服务器环境搭建过程记录贴

LNMP之DISCUZ安装