linux基础-第十八单元_nginx部署
一、基本环境配置
1.1、安装常用软件
yum install wget -y
1.2、Install yum repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
1.3、close firewalld
systemctl disable firewalld
systemctl disable NetworkManager and sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
1.4、安装常用软件
yum install net-tools vim lrzsz screen lsof tcpdump nc mtr nmap -y
yum update -y && reboot
二、安装nginx
官网地址:http://nginx.org/en/download.html
2.1、yum方式安装:
yum install nginx -y
2.2、配置nginx
#配置nginx
[root@nulige ~]# vi /etc/nginx/nginx.conf
#指定配置文件: root /usr/share/nginx/html
#网站存放路径
[root@nulige html]# cd /usr/share/nginx/html
[root@nulige html]# ll
total 24
-rw-r--r-- 1 root root 3650 Mar 6 17:26 404.html
-rw-r--r-- 1 root root 3693 Mar 6 17:26 50x.html
-rw-r--r-- 1 root root 14 Jun 18 16:28 index.html
-rw-r--r-- 1 root root 3700 Mar 6 17:26 index.html.bak
-rw-r--r-- 1 root root 368 Mar 6 17:26 nginx-logo.png
-rw-r--r-- 1 root root 2811 Mar 6 17:26 poweredby.png
#改写主页
[root@nulige html]# echo "welcome nginx" >index.html
[root@nulige html]# cat index.html
welcome nginx
#启动服务
[root@nulige html]# systemctl restart nginx
[root@nulige html]# systemctl status nginx
#访问网站
http://192.168.56.33/
welcome nginx
#配置负载均衡
参考官网:
http://nginx.org/en/docs/http/load_balancing.html
http {
upstream myapp1 {
server srv1.example.com;
server srv2.example.com;
server srv3.example.com;
}
server {
listen 80;
location / {
proxy_pass http://myapp1;
}
}
}
#重启服务
systemc reload nginx
3、编译安装nginx
参考峰哥:http://www.cnblogs.com/linhaifeng/articles/6045600.html#_label19
源码安装: yum install gcc-* glibc-* openssl openssl-devel pcre pcre-devel zlib zlib-devel -y
ls
tar xvf nginx-1.10.3.tar.gz
cd nginx-1.10.3
ls
./configure
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --without-http_rewrite_module #--without-http_rewrite_module代表不使用重写功能,即不会引用pcre库,如果安装过程中出现pcre相关问题,可以指定该参数
make
make install
#所有模块
参考:http://nginx.org/en/docs/
linux基础-第十八单元_nginx部署的更多相关文章
- linux基础-第十四单元 Linux网络原理及基础设置
第十四单元 Linux网络原理及基础设置 三种网卡模式图 使用ifconfig命令来维护网络 ifconfig命令的功能 ifconfig命令的用法举例 使用ifup和ifdown命令启动和停止网卡 ...
- linux基础-第十六单元 yum管理RPM包
第十六单元 yum管理RPM包 yum的功能 本地yum配置 光盘挂载和镜像挂载 本地yum配置 网络yum配置 网络yum配置 Yum命令的使用 使用yum安装软件 使用yum删除软件 安装组件 删 ...
- ASP.NET Core 2.2 基础知识(十八) 托管和部署 概述
为了方便演示,以 .NET Core 控制台应用程序讲解. 我们新建一个控制台应用程序,安装 "Newtonsoft.Json" Nuget 包,然后右键点击该项目,选择" ...
- linux基础-第十五单元 软件包的管理
使用RPM安装及移除软件 什么是RPM rpm的文件名 rpm软件安装与移除工作中经常使用的选项 查看RPM软件包中的信息 查询已安装的软件包信息 RPM包的属性依赖性问题 什么是RPM包的属性依赖性 ...
- linux基础-第十九单元_nfs服务
#服务端部署 介绍: NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的 ...
- Bootstrap <基础二十八>列表组
列表组.列表组件用于以列表形式呈现复杂的和自定义的内容.创建一个基本的列表组的步骤如下: 向元素 <ul> 添加 class .list-group. 向 <li> 添加 cl ...
- Linux基础知识第八讲,系统相关操作命令
目录 Linux基础知识第八讲,系统相关操作命令 一丶简介命令 2.磁盘信息查看. 3.系统进程 Linux基础知识第八讲,系统相关操作命令 一丶简介命令 时间和日期 date cal 磁盘和目录空间 ...
- vue第十八单元(单向数据流 vuex状态管理)
第十八单元(单向数据流 vuex状态管理) #课程目标 1.理解什么是数据管理模式 2.什么是vuex 3.什么时候使用vuex 4.vuex安装及工作原理 5.vuex语法 #知识点 1.首先来看下 ...
- react第十八单元(redux中间件redux-thunk,redux工程目录的样板代码,规范目录结构)
第十八单元(redux中间件redux-thunk,redux工程目录的样板代码,规范目录结构) #课程目标 中间件:中间件增强redux的可扩展性,实现功能复用的目的. redux-thunk异步逻 ...
随机推荐
- wiki1285
2013-09-21 16:50 裸 //By BLADEVIL var n :longint; i :longint; x, y :longint; t, tot :longint; key, s, ...
- 安装l Xposed Framework
How to install Xposed Framework on Android 4.x.x : 1. For Android 4.0.3 through 4.4.4 Visit this X ...
- 全局axios默认值 和 自定义实例默认值
首先说了一下情况, 登录后成功返回token 然后在带着token去继续下面的请求, 奇怪的是都是当前页面起作用,刷新和跳转之后就token 就消失了. 查了 axios文档发现 被自己坑了 我设置了 ...
- algorithm ch15 FastWay
这是DP最基础的一个问题,刚开始学习这一块,实现了一下,不要黑我巨长的参数表,新手. 代码如下: void FastWay(int l1[], int l2[], int e1, int e2, in ...
- html中给元素添加背景图片或者gif动图
添加背景图片有四种常用的方式,分别是: repeat 完全平铺 repeat-x 横向平铺 repeat-y 纵向平铺 no-repeat 不平铺 使用示例: <!DOC ...
- setCharacterEncoding 和 setContentType
request.setCharacterEncoding("gbk"); response.setContentType("text/html;charset=gbk&q ...
- poj1062 最短路径 dijkstra
题目连接:http://poj.org/problem?id=1062 Description 年轻的探险家来到了一个印第安部落里.在那里他和酋长的女儿相爱了,于是便向酋长去求亲.酋长要他用 1000 ...
- 36、Django实战第36天:首页功能开发
1.编辑users.views.py ... class IndexView(View): """ 首页 """ def get(self, ...
- DeprecationWarning: current URL string parser is deprecated解决方法
我最近在使用mongoDB的时候,发现了这个警告语句,纳闷了,按照官方文档的教程去连接数据库还能出错,也是醉了. 后来尝试去阅读相关资料,发现只是需要将{ useNewUrlParser: true ...
- HDUOJ题目HTML的爬取
HDUOJ题目HTML的爬取 封装好的exe/app的GitHub地址:https://github.com/Rhythmicc/HDUHTML 按照系统选择即可. 其实没什么难度,先爬下来一个题目的 ...