linux nginx安装方法

一. linux 下安装lnmp


 一. 安装开发包的依赖扩展库

    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


二. 安装nginx服务

    yum install nginx

    service nginx start

    chkconfig --levels 235 nginx on


三. 安装mysql服务

 yum install mysql mysql-server mysql-devel

 service mysqld start

 chkconfig --levels 235 mysqld on


四. 安装php

   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模式

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

  service php-fpm start

  chkconfig --levels 235 php-fpm on


五.配置nginx解析php

 mv /etc/nginx/nginx.conf /etc/nginx/nginx.confbak

//将配置文件改为备份文件

vim  /etc/nginx/nginx.conf

include /etc/nginx/conf.d/*.conf; 加载conf.d下所有的conf文件

//新建一个ceshi.conf文件

 blob.png

 service nginx restart

 service php-fpm restart


在/data/目录下vim index.php

<?php

echo phpinfo();

?>


访问url地址   http://127.0.0.1:8080/index.php

评论

0条评论