centos7安装nginx-1.13.6 新手入门,图文解析
2017-11-18 11:06
288 查看
系统环境
操作系统:64位CentOS Linux release 7.2.1511 (Core)安装nginx依赖包
[root@localhost ~]# yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl—devel必须要安装,时间可能有点久。
下载nginx
下载地址:http://nginx.org/en/download.html下载最新的nginx-1.13.6(写笔记时,这个版本是最新的),下载好之后,在centos系统中创建/soft目录
[root@localhost ~]# mkdir /soft
利用工具WinSCP,将下载好的nginx包拷贝到centos下的/soft目录
解压nginx
[root@localhost ~]# cd /soft[root@localhost soft]# tar -zxvf nginx-1.13.6.tar.gz
编译和安装nginx
[root@localhost soft]# cd nginx-1.13.6/[root@localhost nginx-1.13.6]# ./configure --prefix=/usr/local/nginx
指定安装在/usr/local/nginx目录下,不指定也没关系,默认就是这个目录。
[root@localhost nginx-1.13.6]# make && make install
查看nginx版本号:
[root@localhost ~]# cd /usr/local/nginx/sbin/[root@localhost sbin]# ./nginx -h
开启80端口
[root@localhost conf]# firewall-cmd --zone=public --add-port=80/tcp --permanent[root@localhost conf]# firewall-cmd --reload
启动和停止nginx
启动[root@localhost sbin]# ./nginx
停止
[root@localhost sbin]# ./nginx -s stop
重启
[root@localhost sbin]# ./nginx -s reload
浏览
在浏览器地址栏输入http://192.168.1.100/参考网址
https://www.cnblogs.com/lxg0/p/6979274.html简单配置
下面这段配置是最最最简单的负载均衡配置,文件名nginx_fzjh.conf,只要在我们启动nginx的时候,指定这个配置文件就行了([root@localhost sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx_fzjh.conf)worker_processes 4; events{ worker_connections 1024; } http{ server { listen 80; server_name myserver; location / { proxy_pass http://mysite; } } upstream mysite { #ip_hash; server 10.101.56.52:80;# weight=5; server 10.101.56.52:8089;# weight=3; #server x.x.x.x:80 weight=1; } }
只看不回复,诅咒你钉钉0.0000000001厘米。
相关文章推荐
- centos7安装tomcat8 新手入门 图文教程
- centos7安装apache 新手入门 图文教程
- 《Oracle Golden Gate 概念和原理》-新手入门->深入解析->图文
- centos7安装kafka_2.11-1.0.0 新手入门
- laravel 4安装及入门图文教程
- centos7 nginx1.10.2编译安装
- centos7安装zabbix3.0超详细步骤解析
- 一步一步教你centos7安装nginx1.13.4
- centos7安装nginx
- centos7系统下nginx安装并配置开机自启动操作
- centos7安装nginx1.12.2步骤指南
- Nginx安装与配置文件解析
- Nginx安装与配置文件解析
- Centos7服务器上nginx、jdk、mysql安装
- centOS7上安装nginx
- centOS7 安装nginx+php+mysql
- CentOS7 上学习使用docker 【安装Nginx】
- centos7安装nginx1.10.1
- 最全面 Nginx 入门教程 + 常用配置解析
- 1、nginx入门篇之--安装