centos7 yum安装配置Lnmp和负载配置
首先配置防火墙
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和负载配置的更多相关文章
- centos7 yum安装配置redis 并设置密码
原文:https://www.cnblogs.com/fanlinglong/p/6635828.html centos7 yum安装配置redis 并设置密码 1.设置Redis的仓库地址 yum ...
- centos7 yum 安装lnmp
centos7 yum 安装lnmp 安装7.2把7.1改成7.2就行 使用第三方扩展epel源安装php7.2 #移除旧版php [root@web02 ~]# yum remove php-m ...
- centos7 编译安装新版LNMP环境
centos7 编译安装新版LNMP环境 环境版本如下: 1.系统环境:Centos 7 x86_64 2.NGINX:nginx-1.11.3.tar.gz 3.数据库:mariadb-10.0.2 ...
- centos7 yum安装MongoDB
centos7 yum安装MongoDB 原文博客地址http://xgs888.top/post/view?id=64 centos7 yum安装mongodb: 1:创建仓库 vi /etc/ ...
- CentOS7 yum 安装 Nginx最新版本
CentOS7 yum 安装 Nginx最新版本 下载对应当前系统版本的nginx包(package) # wget http://nginx.org/packages/centos/7/noarc ...
- CentOS7 yum 安装git
1.查看系统是否已经安装git git --version 2.CentOS7 yum 安装git yum install -y git 3.安装成功 4.卸载git yum remove git
- [转帖]Centos7 yum安装Chrome浏览器
Centos7 yum安装Chrome浏览器 https://www.cnblogs.com/ianduin/p/8727333.html以及https://blog.csdn.net/libaine ...
- centos7 yum安装遇到报错:Head V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEYer
centos7 yum安装时遇到错误:Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY 无法安装时,可按如下方法解决: This mini ...
- CentOS6 CentOS7 yum安装图形界面
CentOS6 yum安装图形界面yum groupinstall -y "Desktop" "Desktop Platform" "Desktop ...
- CentOS7 yum 安装与配置MySQL5.7
安装环境:CentOS7 64位 MINI版,安装MySQL5.7 1.配置YUM源 在MySQL官网中下载YUM源rpm安装包:https://dev.mysql.com/downloads/rep ...
随机推荐
- DEV 导出多行头
//在winfrom 中添加个Gridcontrol 和按钮 public partial class MultTitle : XtraForm { BandedGridView bandedGrid ...
- 阿里巴巴Java代码规范(一)
现代软件架构都需要协同开发完成,高效协作即降低协同成本,提升沟通效率,所谓无规矩不成方圆,无规范不能协作. 本博客是对<阿里巴巴Java开发手册>的学习记录.大多记录的是强制规约,具体请参 ...
- kunkun
<html> <head> <title>cxk</title> </head> <body><h1>给设计师:字体 ...
- 分布式计算 Distributed computing
分布式计算(Distributed computing),又译为分散式运算,是一门计算机科学,它研究如何把一个需要非常巨大的计算能力才能解决的问题分成许多小的部分,然后把这些部分分配给许多计算机进行处 ...
- java spring 理解
1.spring IOC容器 其实就是 new 了一个 ApplicationContext 类对象.->应用上下文对象. 2.应用上下文对象 实例化.配置,并管理 bean. 所以上下文对象是 ...
- 【虚拟机】虚拟机安装win10
VMware-workstation 16 pro 点击查看代码 密钥: ZF3R0-FHED2-M80TY-8QYGC-NPKYF YF390-0HF8P-M81RQ-2DXQE-M2UT6 ZF7 ...
- (1019) rapidsvn 安装
https://blog.csdn.net/mzpmzk/article/details/106332039
- Linux的top命令原理简单了解
top命令描述机器的cpu.内存等状态信息. 每3s刷新一次. 是procps工具集中的一个,该工具集还包括free.ps等等 top命令的代码实现逻辑是:由内核动态生成一个伪文件系统,提供一个内核状 ...
- perf 编译失败
linux-6.0-rc2 : linux-6.0-rc2/tools/include/asm/../../arch/x86/include/asm/rmwcc.h:7:9: error: impli ...
- linux交叉编译libiconv
1.解压libiconv-1.14.tar 2.进入解压后目录libiconv-1.14 3.执行交叉编译环境命令,例如: source /home/huhe/environment-setup-aa ...