CentOS 7服务器下Nginx安装配置
一、安装编译工具及库文件
$ yum -y install make zlib zlib-devel gcc gcc-c++ libtool openssl openssl-devel pcre pcre-devel //PCRE 作用是让 Nginx 支持 Rewrite 功能
二、安装Nginx
1、下载Nginx至文件夹/usr/local内
$ cd /usr/local/ //进入目标目录
$ wget http://nginx.org/download/nginx-1.14.2.tar.gz //下载nginx,选择稳定版本
2、解压缩文件包
$ tar zxvf nginx-1.14.2.tar.gz
3、进入安装目录,编译安装
$ cd nginx-1.14.2
$ ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-pcre --with-http_ssl_module
$ make
$ make install
安装完成后的摘要信息:
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ using system zlib library nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
默认安装到/usr/local/nginx目录。
4、查看Nginx版本
$ /usr/local/nginx/sbin/nginx -v
输出结果如下:
nginx version: nginx/1.14.2
到此,nginx安装完成。
5、启动、关闭Nginx
检查配置文件是否正确
$ /usr/local/nginx/sbin/nginx -t
$ /usr/local/nginx/sbin/nginx -V //可以看到编译选项
启动Nginx
$ /usr/local/nginx/sbin/nginx // 启动
$ /usr/local/nginx/conf/nginx.conf //配置文件
重新载入配置文件
$ /usr/local/nginx/sbin/nginx -s reload
重启Nginx,不会改变启动时指定的配置文件
$ /usr/local/nginx/sbin/nginx -s reopen
停止Nginx
$ /usr/local/nginx/sbin/nginx -s stop
或
$ pkill nginx
三、Nginx配置
具体配置可搜索,这里不做介绍
配置文件nginx.conf,位置
/usr/local/nginx/conf/nginx.conf
四、防火墙配置
CentOS7默认的防火墙为firewall
开启端口80方法:
$ firewall-cmd --zone=public --add-port=80/tcp --permanent //--permanent永久生效,没有此参数重启后失效
$ firewall-cmd --reload //重新载入
$ firewall-cmd --zone=public --query-port=80/tcp //查看
//$ firewall-cmd --permanent --query-port=80/tcp //或者这样查看
$ firewall-cmd --zone=public --remove-port=80/tcp --permanent //删除端口
.
CentOS 7服务器下Nginx安装配置的更多相关文章
- CentOS 6.3下NFS安装配置
CentOS 6.3下NFS安装配置 一.环境介绍 NFS服务器:CentOS6.3 192.168.8.20 NFS客户端:CentOS6.5 192.168.8.39 二.服务器端安装配置 ...
- VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三)
首先启动Nginx 1. 相关浏览 两个 Tomcat 配置: VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二) Nginx 安装配置启动: VMware Linu ...
- VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二)
准备工作 相关浏览: VMware Linux 下 Nginx 安装配置 (一) 1. 选在 /usr/local/ 下创建 softs 文件夹,通过 ftp 命令 把 apache-tomcat-7 ...
- Centos 6.5 下Nginx安装部署https服务器
一般我们都需要先装pcre, zlib,前者为了重写rewrite,后者为了gzip压缩.1.选定源码目录选定目录 /usr/local/cd /usr/local/2.安装PCRE库cd /usr/ ...
- red5下nginx安装配置
http://zfl110.iteye.com/blog/1155149 原址:http://lqw.iteye.com/blog/652763 安装Nginx 1.首先安装pcre-8.02.tar ...
- linux下Nginx 安装配置
Nginx 安装 一.首先要安装 PCRE PCRE 作用是让 Ngnix 支持 Rewrite 功能. 1.下载 PCRE 安装包,下载地址: http://downloads.sourceforg ...
- CentOS 6.5下NFS安装配置
[root@local /]# yum -y install nfs-utils rpcbind3.创建共享目录:[root@local /]# mkdir /sharestore4.NFS共享文件路 ...
- VMware Linux 下 Nginx 安装配置 (一)
资源准备 1. pcre-8.34.tar.gz: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ 2. zlib-1.2.8.tar.g ...
- CentOS 6.6下Redis安装配置记录
转载于:http://www.itxuexiwang.com/a/shujukujishu/redis/2016/0216/120.html?1455855209 在先前的文章中介绍过redis,以下 ...
随机推荐
- 抽奖JQ
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8 ...
- 了解jQuery的detach()和remove()
jQuery中提供了两种移出一个DOM元素的方法detach()和remove(),虽然是一样的功能,但是给出两种方法,必然有它的不同之处. empty() 单独说一下 ,它删除当前元素的所有子元素, ...
- djnago中间件
前言 在form表单中当我们提交表单时会有这样的错误>>>>请求post时候的会出现403 forbidden,那我们就说说这个类中间件,(csrf只是中间件的一种) 以前我们 ...
- redis和memcacahe、mongoDB的区别
都是非关系型数据库,性能都非常高,但是mongoDB和memcache.redis是不同的两种类型.后两者主要用于数据的缓存,前者主要用在查询和储存大数据方面,是最接近数据库的文档型的非关系数据库. ...
- $(selector).each() 和$each() 的区别
今天在做项目的时候, 后台数据需要循环遍历出来, 想到each, 结果,竟然不记得语法了 现在来回顾一下,而搜索了一下,竟然发现有两种each 一种就是$(selector).each() ...
- P2172 [国家集训队]部落战争 二分图最小不相交路径覆盖
二分图最小不相交路径覆盖 #include<bits/stdc++.h> using namespace std; ; ; ; ], nxt[MAXM << ], f[MAXM ...
- vue中父组件使用props或者$attras向子组件中传值
知识点:vue中使用props或者$attras向子组件中传值 (1) props传值 子组件必须注册好要传的数据() props:['id'] (2)$attrs传值 该数据在props中,没有注册 ...
- bitcoind搭建
https://degreesofzero.com/article/installing-bitcoind-on-ubuntu.html1. sudo apt-get install python-s ...
- SQL 归纳
查询父节点的所有子节点: SELECT * FROM menu m START WITH m.ID_ = '402882836068695f0160688eebf70006' CONNECT BY m ...
- C#新增按钮
代码亲测可用,似乎不需要“ADD”,如下:form_load段:for (int i = 0; i < 10; i++){btn = new Button();btn.Parent = this ...