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 ...
随机推荐
- python 日志分割器 大文本处理
import math i=0 filename='' write='' Rline = '' def writeFile(fileName,line): global filename global ...
- python查找文件、移动、重命名、压缩
在文件同级目录下存在sourcefile.targetfile两个文件夹,源文件放在sourcefile import os import shutil Apath = os.path.dirname ...
- vscode中配置代码片段
首先我们需要把要配置的代码复制一下,如: 然后我们进入https://snippet-generator.app/网站, 进入网站之后就把你复制的代码粘贴到左边的框里面,然后就是代码的类型和命名了 写 ...
- JavaScript基本知识整理(基本包装类型)
基本包装类型 为了方便地操作基本类型变量,ECMAScript规定了3个特殊引用类型分别是Boolean,Number和String. 这三种特殊引用类型同时具有基本类型和引用类型的功能,当我们读取一 ...
- Python列表等长度分割
1 def list_of_groups(init_list, childern_list_len): 2 ''' 3 :param init_list: 4 :param childern_list ...
- 软件工程日报八——AlertDiatog的使用
今天学习了AlertDiatog的相关内容 AlertDialog可以在当前的界面上显示一个对话框,这个对话框是置顶于所有界面元素之上的,能够屏蔽掉其他控件的交互能力,因此AlertDialog一般是 ...
- mariadb 集群 重启的几种情形
最近项目中遇到过一次mariadb集群中三台节点有两台挂掉的情况.总结了一下mariadb集群可能遇到的几种情况需要重启. 环境说明: mariadb集群ip: 10.0.101.51 10.0.10 ...
- 剑指 Offer II 二分查找
068. 查找插入位置 class Solution { public: int searchInsert(vector<int>& nums, int target) { int ...
- idea远程连接云服务器,并将本地代码部署在云端进行运算
电脑内存和显存过小,需要在云服务器进行运算我的模型,由于一直在自己的电脑上写的代码,于是之间迁移代码到云服务器,只要通过ssh链接到云端后,将python解释器使用云端的解释器就ok 从 file-- ...
- 安防视频监控系统前端摄像机——DSP与SOC摄像机
一.DSP摄像机 DSP(Digital Signal Processing)即数字信号处理,它是利用数字计算机或专用数字信号处理设备,以数值计算的方法对信号进行采集.变换.综合.估值.识别等加工处理 ...