首页 技术 正文
技术 2022年11月14日
0 收藏 598 点赞 3,008 浏览 2216 个字

 

1:查看环境:

?

12 [root@10-4-14-168 html]# cat /etc/redhat-release CentOS release 6.5 (Final)

2:关掉防火墙

?

1 [root@10-4-14-168 html]# chkconfig iptables off

3:配置CentOS 6.0 第三方yum源(CentOS默认的标准源里没有nginx软件包)

?

1 #wget http://www.atomicorp.com/installers/atomic

?

1 #sh ./atomic

?

1 #yum check-update

4:安装开发包和库文件 

?

1234 #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

5:卸载已安装的apache、mysql、php

?

123 # yum remove httpd# yum remove mysql# yum remove php

6:安装nginx

?

1234 # yum install nginx# service nginx start# chkconfig --levels 235 nginx on//设2、3、5级别开机启动

7:安装mysql

?

123 # yum install mysql mysql-server mysql-devel# service mysqld start# chkconfig --levels 235 mysqld on

?

12345678 登陆MySQL删除空用户,修改root密码mysql>select user,host,password from mysql.user; mysql>drop user ''@localhost; mysql>update mysql.user set password = PASSWORD('*********') where user='root'; mysql>flush privileges;

  

8:安装php

?

12 # 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

//安装php和所需组件使PHP支持MySQL、FastCGI模式

?

1 #yum install  php-tidy php-common php-devel php-fpm php-mysql

?

12 # service php-fpm start# chkconfig --levels 235 php-fpm on

9:配置nginx支持php

?

12345678910111213141516171819 # mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak//将配置文件改为备份文件 # cp /etc/nginx/nginx.conf.default /etc/nginx/nginx.conf//由于原配置文件要自己去写因此可以使用默认的配置文件作为配置文件 //修改nginx配置文件,添加fastcgi支持# vi /etc/nginx/nginx.confindex index.php index.html index.htm;//加入index.php location ~ \.php$ {            root           /usr/share/nginx/html;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;            include        fastcgi_params;        }//将以上代码注释去掉,并修改成nginx默认路径

  

?

1  

10:配置php

?

12 //编辑文件php.ini,在文件末尾添加cgi.fix_pathinfo = 1[root@CentOS ~]# vi /etc/php.ini

11:重启nginx php-fpm

?

12 # service nginx restart# service php-fpm restart

  

12:建立info.php文件

?

1234 # vi /usr/share/nginx/html/info.php<?php   phpinfo();?>

  

13:测试nginx是否解析php

?

12 本地浏览器输入:192.168.1.105/info.php显示php界面  环境搭建成功
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,082
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,557
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,406
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,179
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,815
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898