YUM安装LNMP环境

环境:Centos 6.6

[[email protected] ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[[email protected] ~]# getenforce
Disabled
[[email protected] ~]#

安装Nginx:

[[email protected] ~]# yum -y remove httpd
[[email protected] ~]# yum -y install nginx
[[email protected] ~]# chkconfig nginx on

安装Mysql:

[[email protected] ~]# yum -y install mysql mysql-server mysql-devel
[[email protected] ~]# cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
[[email protected] ~]# chkconfig mysqld on
[[email protected] ~]# /etc/init.d/mysqld start
[[email protected] ~]# mysqladmin -uroot password "redhat"
[[email protected] ~]# mysql_secure_installation

安装PHP及其依赖包:

[[email protected] ~]# yum -y install php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm php-cli php-pdo php-tidy php-pecl-memcache php-eaccelerator
[[email protected] ~]# chkconfig php-fpm on

配置Nginx:

[[email protected] ~]# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
[[email protected] ~]# cd /etc/nginx/conf.d/
[[email protected] conf.d]# cp default.conf default.conf.bak
[[email protected] conf.d]# grep -v ‘#‘ /etc/nginx/nginx.conf|grep -v ^$ |head -2
user nginx nginx;
worker_processes  5;
[[email protected] ~]#
[[email protected] conf.d]# grep -v ‘#‘ default.conf |grep -v ^$
server {
    listen       80;
    server_name  192.168.31.160;
    include /etc/nginx/default.d/*.conf;
    location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }
    location ~ ^(.+.php)(.*)$ {
        root /var/www/html;
        fastcgi_split_path_info ^(.+.php)(.*)$;
        include fastcgi.conf;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
 fastcgi_param  PATH_INFO          $fastcgi_path_info;
    }
    error_page  404              /404.html;
    location = /404.html {
        root   /usr/share/nginx/html;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}
[[email protected] conf.d]#

配置PHP:

[[email protected] ~]# cd /etc/php-fpm.d/
[[email protected] php-fpm.d]# grep nginx www.conf
user = nginx
group = nginx
[[email protected] php-fpm.d]#
[[email protected] ~]# cd /var/www/html/
[[email protected] html]# cat info.php
<?php
phpinfo();
?>
[[email protected] www]# chown nginx:nginx html/ -R
[[email protected] ~]# /etc/init.d/php-fpm start
Starting php-fpm:                                          [  OK  ]
[[email protected] ~]#
[[email protected] ~]# /etc/init.d/nginx start
Starting nginx:                                            [  OK  ]
[[email protected] ~]#

时间: 2024-08-27 23:21:31

YUM安装LNMP环境的相关文章

阿里云centos6(32bit)yum安装lnmp环境

========================================================================================= 挂载数据盘 https://help.aliyun.com/knowledge_detail/5974154.html fdisk -l 执行"fdisk  /dev/xvdb"命令,对数据盘进行分区: 根据提示,依次输入"n","p""1",两次回

CentOS编译安装LNMP环境

这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables   #编辑防火墙配置文件 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT(允许80端口通过防火墙) -A INPUT -m state -

cenos6.5源码包安装lnmp环境

虽然centos6可以用yum安装nginx,但是我还是写个教程用源码包安装用于线上环境. 一:在nginx官网下载nginx,并安装 我下载的是nginx-1.6.0 #./configure --prefix=/usr/local/nginx make&& make install 卸载已存在的apache服务和php [[email protected] Desktop]# yum remove httpd php* 安装development Tools [[email prote

centos下编译安装LNMP环境

自PHP-5.3.3起,PHP-FPM加入到了PHP核心,编译时加上--enable-fpm即可提供支持. PHP-FPM以守护进程在后台运行,Nginx响应请求后,自行处理静态请求,PHP请求则经过fastcgi_pass交由PHP-FPM处理,处理完毕后返回. Nginx和PHP-FPM的组合,是一种稳定.高效的PHP运行方式,效率要比传统的Apache和mod_php高出不少. 二.依赖环境 yum -y install gcc gcc-c++ make cmake automake au

CentOS安装LNMP环境的基础组件

注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. 在安装LNMP环境之前,请确保已经使用yum安装了以下各类基础组件(如果系统已自带,还可以考虑yum update下基础组件): gcc cmake openssl+openssl-devel pcre+pcre-devel bzip2+bzip2-devel libcurl+curl+curl-devel libjpeg+libjpeg-devel libpng+libpng-devel freetype+freetype-

linux yum 安装 lnmp(linux+php+mysql)

yum搭建lnmp环境(CentOS6) 1.关闭防火墙[[email protected] ~]# chkconfig iptables off 2.关闭selinuxvi /etc/sysconfig/selinux //将SELINUX=enforcing修改为disabled然后重启生效 3.配置CentOS 6.0 第三方yum源(CentOS默认的标准源里没有nginx软件包)[[email protected] ~]# yum install wget//下载wget工具[[ema

Shell脚本一键安装LNMP环境

https://sourceforge.net/projects/opensourcefile/files/ Nginx是一款高性能的HTTP和反向代理服务器.Nginx在反向代理,Rewrite规则,稳定性,静态文件处理,内存消耗等方面表现了很强的优势.因此公司线上和测试环境的WEB服务大多数采用的是LNMP环境,经常要进行LNMP环境的搭建,下面是用SHELL脚本写的一键安装LNMP环境的脚本.1)系统环境介绍Centos 5.8 64位 (已测试)Nginx: nginx-1.4.1.ta

vagrant 下安装lnmp 环境

今天使用 vagrant 安装了 lnmp 包,感觉还是不错的,值得纪录一下 首先呢,我安装了一个 centos65 ,具体的命令是这样的(box 在本地) vagrant box add centos65 /Users/zeopean/Downloads/mac/centos65-x86_64-20140116.box 接下来,我的vagrant 就装好了,需要初始化 vagrant init centos65 vagrant up 需要注意的是,有可能现在呢的 Vagrantfile 文件中

运维自动化之ansible playbook安装lnmp环境

之前介绍了使用ansible playbok安装zabbix客户端.mysql服务端.nginx,现在介绍一下安装lnmp环境. 下面是安装nginx的信息: nginx_user: www                        nginx用户 nginx_port: 80                         nginx监听端口 nginx_web_dir: /data/webroot/nginx     nginx的目录 nginx_version: 1.4.3