首先配置防火墙
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. PHP中的超级变量

    超级变量,又名超级全局变量,是PHP内置的变量,这些变量在代码的任意位置都能正常使用 PHP中的超级变量 9种超级变量 $GLOBALS $_SERVER 9种超级变量 目前,PHP提供了9种超级变量 ...

  2. VUE学习-过滤器

    过滤器 常用于 过滤数据 或者 格式化数据 <div class="main-container"> <div class="datetime-wrap ...

  3. mysql错误号码2003 can't connect to mysql server on 'localhost' (0)解决方案

    找到mysql安装目录下的Bin目录,在cmd中进入这个目录,运行net start mysql 却显示服务名无效 所以此时 首先在MYSQL的安装目录bin下,输入mysqld --install ...

  4. gitlab-CICD共享runner基本配置

    gitlab-CICD共享runner基本配置 使用docker部署runner 多个项目使用共享runner 部署机器与runner不在同一台服务器上(使用ssh部署) 部署runner 部署镜像 ...

  5. P2016题解

    P2016题解 题目描述 Bob要建立一个古城堡,城堡中的路形成一棵无根树.他要在这棵树的结点上放置最少数目的士兵,使得这些士兵能瞭望到所有的路. 注意,某个士兵在一个结点上时,与该结点相连的所有边将 ...

  6. 均值、中值、高斯、non-local means算法详解

    文章仅为个人理解,如有不妥之处欢迎指正. 写几个常见的图像去噪滤波器. 1.均值滤波器 均值滤波器是最简单的图像平滑滤波器,其3*3的模板为 1 9 [ 1 1 1 1 1 1 1 1 1 ] \fr ...

  7. oracle 根据逗号拆分字符串一行转多行

    SELECT A.*, REGEXP_SUBSTR( A.PRODUCTNUMS, '[^,]+', 1, L ) AS PRODUCTNUM,L FROM LG_ZJQH_PRODUCTVALUES ...

  8. win10上打包的qt程序放到win7上打不开的解决方法

    在win 10 上编写并打包发布了qt5.12.3 msvc2017 32bit的qt程序,在其他win10 电脑上都能正常运行,但是放到win7电脑上,运行exe时依次出现缺少"msvcp ...

  9. Linux 安装jdk教程

    https://www.cnblogs.com/mabiao008/p/12059069.html

  10. python 成功解决import librosa出错问题

    在做音频处理时,用到了librosa这个库,但是一直在报错,一开始以为代码错误,后来发现import的时候就已经出错了. 我给他卸载了重新安装,结果是一样的,报错如下: Traceback (most ...