首先配置防火墙
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. 多点DLT (Direct Linear Transformation) 算法

    阅读前可以先参看上一篇代数视觉博客: 四点DLT (Dierct Linear Transformation) 算法 对于大于4个点的数据点来进行 DLT 算法变换, 如果数据点的标注都十分准确,那么 ...

  2. docker 创建 network 指定ip 段

    docker network create -d bridge --gateway 172.22.0.1 --subnet 172.22.0.0/16 zk_default

  3. ESLint未定义报错

    vue框架, ---   .eslintrc.js : module.exports = { root: true, env: { node: true }, 'extends': [ 'plugin ...

  4. springmvc引入swagger2

    swagger2 简介 ​ API Developmentfor Everyone. ​ Simplify API development for users, teams, and enterpri ...

  5. EL表达式读取属性不存在的异常,读取类的属性不存在,无法调用到该属性

    修改类中的名称,必须要符合2JavaBaen要求,否则EL表达式读取不到.

  6. C3861: “CoInitialize”“CoUninitialize”: 找不到标识符

    error C3861: "CoInitialize": 找不到标识符error C3861: "CoUninitialize": 找不到标识符 包含头文件和链 ...

  7. 理解redux中间件

    redux questions : 1. reducers 函数如何创建和聚合 2. action创建函数如何如何包裹在dispatch函数中 3. 如何给默认的dispatch方法增加中间件能力 m ...

  8. Mac下Homebrew更新国内源brew update卡死(完美解决,网上都不完整)

    https://blog.csdn.net/zz00008888/article/details/113880633

  9. nodejs,阿里云手机号一键登录

    const Core = require('@alicloud/pop-core'); const accessKeyId = "xxxx" const accessSecret ...

  10. popen函数和pyinstaller打包之 -w冲突

    启发文章:https://www.jb51.net/article/184731.htm 之前我也是用到了os.popen()这个函数 1.os.popen(self.excel_path)  括号里 ...