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异步逻 ...
随机推荐
- GridPanel分页条插件
GridPanel的分页条没有设置当前页显示条数的功能,会不大方便 主要是抄袭的http://www.cnblogs.com/badwps/archive/2011/04/15/2016440.htm ...
- shelve,xml,re模块
一.shelve模块 shelve模块比pickle模块简单,只有一个open函数,返回类似字典的对象,可读可写;key必须为字符串,而值可以是python所支持的数据类型 import shelve ...
- python3,判断,循环练习1
1.使用while循环输出1 2 3 4 5 6 8 9 10 i = 1 while i <= 10: if i == 7: i += 1 print(end=' ') continue pr ...
- LeetCode the longest palindrome substring
回文检测,参考http://blog.csdn.net/feliciafay/article/details/16984031 使用时间复杂度和空间复杂度相对较低的动态规划法来检测,具体的做法 图一 ...
- LeetCode 6:Excel Sheet Column Number
Given a column title as appear in an Excel sheet, return its corresponding column number. For exampl ...
- Linux2.6.32内核笔记(5)在应用程序中移植使用内核链表【转】
转自:http://blog.csdn.net/Deep_l_zh/article/details/48392935 版权声明:本文为博主原创文章,未经博主允许不得转载. 摘要:将内核链表移植到应用程 ...
- 移动APP 支付宝快捷支付开发流程
[代码] [Java]代码 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ...
- Go语言map映射的基本操作
对比python, java都有对应的字典类型及哈希类型. package main import ( "fmt" ) //main is the entry of the pro ...
- [BZOJ2653]middle 主席树+二分
2653: middle Time Limit: 20 Sec Memory Limit: 512 MBSubmit: 2042 Solved: 1123[Submit][Status][Disc ...
- head first (二):观察者模式
首先推荐一下别人写的,很不错可以参考,http://www.cnblogs.com/li-peng/archive/2013/02/04/2892116.html 1.定义 观察者模式:在对象之间定义 ...