首先配置防火墙
CentOS 7.0默认使用的是firewall作为防火墙
1.关闭firewall:

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2.关闭SELINUX

vi /etc/selinux/config
#SELINUX=enforcing #注释掉
SELINUX=disabled #增加
:wq! #保存退出
setenforce 0 #使配置立即生效
Lnmp安装

1.安装nginx

yum install yum-priorities -y
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install nginx
2.启动nginx

systemctl start nginx.service #启动nginx
systemctl stop nginx.service #停止
systemctl restart nginx.service #重启
systemctl enable nginx.service #设置开机启动
3.更改nginx端口号(根据自己需求)

cd /etc/nginx/conf.d/
vim default.conf
把listen 80改成listen 81
然后重启nginx
systemctl restart nginx.service #重启nginx
4.访问http://ip:81即可看到nginx首页 5.下一步安装PHP-fpm

yum install php-fpm
安装完毕后
systemctl start php-fpm.service #启动php-fpm
systemctl enable php-fpm.service #设置开机启动
6.更改nginx配置文件识别php vi /etc/nginx/conf.d/default.conf,把之前的#给去掉就可以了,顺手改一下fastcgi_param

location ~ \.php$ {
root 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;
}
7.访问test.php

在 /usr/share/nginx/html中新建一个test.php

访问http://ip:81/test.php即可看到nginx中的php页面
8.负载配置

进入 vi /etc/nginx/conf.d/default.conf

upstream site{
server 172.16.170.138;
server 172.16.170.139;
}
server {
listen 80;
server_name localhost;

#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
proxy_pass http://site;
}
9.域名修改 把上面site,localhost改为www.a.com

 
 
 

发布日期: 2016-12-20 作者: 511遇见

所属分类: Linux/Centos/Os 标签: CentOS7 LNMP

centos7 yum安装配置Lnmp和负载配置的更多相关文章

  1. centos7 yum安装配置redis 并设置密码

    原文:https://www.cnblogs.com/fanlinglong/p/6635828.html centos7 yum安装配置redis 并设置密码 1.设置Redis的仓库地址 yum ...

  2. centos7 yum 安装lnmp

    centos7 yum 安装lnmp   安装7.2把7.1改成7.2就行 使用第三方扩展epel源安装php7.2 #移除旧版php [root@web02 ~]# yum remove php-m ...

  3. centos7 编译安装新版LNMP环境

    centos7 编译安装新版LNMP环境 环境版本如下: 1.系统环境:Centos 7 x86_64 2.NGINX:nginx-1.11.3.tar.gz 3.数据库:mariadb-10.0.2 ...

  4. centos7 yum安装MongoDB

    centos7 yum安装MongoDB   原文博客地址http://xgs888.top/post/view?id=64 centos7 yum安装mongodb: 1:创建仓库 vi /etc/ ...

  5. CentOS7 yum 安装 Nginx最新版本

    CentOS7 yum 安装 Nginx最新版本 下载对应当前系统版本的nginx包(package) # wget  http://nginx.org/packages/centos/7/noarc ...

  6. CentOS7 yum 安装git

    1.查看系统是否已经安装git git --version 2.CentOS7 yum 安装git yum install -y git 3.安装成功 4.卸载git yum remove git

  7. [转帖]Centos7 yum安装Chrome浏览器

    Centos7 yum安装Chrome浏览器 https://www.cnblogs.com/ianduin/p/8727333.html以及https://blog.csdn.net/libaine ...

  8. centos7 yum安装遇到报错:Head V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEYer

    centos7 yum安装时遇到错误:Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY 无法安装时,可按如下方法解决: This mini ...

  9. CentOS6 CentOS7 yum安装图形界面

    CentOS6 yum安装图形界面yum groupinstall -y "Desktop" "Desktop Platform" "Desktop ...

  10. CentOS7 yum 安装与配置MySQL5.7

    安装环境:CentOS7 64位 MINI版,安装MySQL5.7 1.配置YUM源 在MySQL官网中下载YUM源rpm安装包:https://dev.mysql.com/downloads/rep ...

随机推荐

  1. [后端-python实战总结]-chapter1-python基础01

    1.1 week 1 > 密码秘文: import getpass username = input('username:') passwd = getpass.getpass('passwd: ...

  2. c++ class基础知识

    目录 class 创建对象 通过对象指针访问类成员 类方法可以定义在类体外部(要用到域解析符:. 类成员/类方法访问权限 构造函数 析构函数Destructor this指针 静态变量 静态函数 co ...

  3. 寒假acm训练第三周

    这个题就是简单的数学思维 如果这个数组里全部都是10的倍数那直接计数达到n就直接出0 如果有其它不是10的倍数那找出最小的直接减去就可以了 下面就是代码 #include<iostream> ...

  4. 【27期】Dubbo面试八连问,这些你都能答上来吗?

    1.Dubbo是什么? Dubbo是阿里巴巴开源的基于 Java 的高性能 RPC 分布式服务框架,现已成为 Apache 基金会孵化项目.致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA ...

  5. LESS-8

    根据题目,这是一道布尔型注入.页面只有返回正常和不正常两种. payload: ' and substr(database(),1,1)='s' --+  判断当前数据库名的第一个字母,是's'页面就 ...

  6. window下快速启动mysql,bat脚本

    cls @echo off:设置窗口字体颜色color 0a :设置窗口标题TITLE MySQL管理程序 call :checkAdmin goto menu:菜单:menuclsecho. ech ...

  7. React.js 修改文本中数字样式

    export function numberToColor(text, color = '#635BFF', size = '12px') { let reg = /(\d+)/g; return t ...

  8. 基于DFA算法实现的敏感词过滤

    本文转自浅析敏感词过滤算法(C++),自己也在其基础上根据自己的情况做了一点修改. https://blog.csdn.net/u012755940/article/details/51689401? ...

  9. Python的入门学习Day 10~13——form”夜曲编程“

    Day 10 time:2021.8.7. ​ 今天本来打算学习时发现手机应该拿去充电了,再上完J课程之后发现时间确实只留到了晚上呢 .但幸好,以我多天的敲代码的牢固根基(哈哈哈),我最终还是弥补回来 ...

  10. typora文件中不显示公式

    行内公式在typora中不显示 解决办法 打开typora--文件(F)--偏好设置--markdown--内联公式--打勾选中 若改后没有反应,关闭重新打开.