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,以下 ...
随机推荐
- weblogic 反序列化漏洞 getshell
上传cmd.jsp,效果: 上传马:
- 程序员和IT员不能错过的网站
前言本文收录一些值得收藏的开发相关网站. 目录一.搜索引擎二.在线课程三.在线练习四.在线工具箱五.在线编译器六.技术论坛或社区七.音乐放松一下 一.搜索引擎搜索引擎大家最熟悉不过,本没有必要列出,但 ...
- C和指针课后问答题答案翻译
第11章 动态内存分配 1.在你的系统中,你能够声明的静态数组最大长度能达到多少?使用动态内存分配,你最大能够获取的内存块有多大? 英文答案原文: This will vary from system ...
- 2.04_Python网络爬虫_Requests模块
一:Requests: 让 HTTP 服务人类 虽然Python的标准库中 urllib2 模块已经包含了平常我们使用的大多数功能,但是它的 API 使用起来让人感觉不太好,而 Requests 自称 ...
- golang shell 交叉编译
#!/usr/bin/env bash set -e uname_s=`uname -s | awk '{print tolower($0)}'` uname_m=`uname -m` timeTag ...
- JS继承的原理、方式和应用
概要: 一.继承的原理 二.继承的几种方式 三.继承的应用场景 什么是继承? 继承:子类可以使用父类的所有功能,并且对这些功能进行扩展.继承的过程,就是从一般到特殊的过程.要了解JS继承必须首先要了解 ...
- eclipse安装Bug检查工具
第一步:下载spotbugs工具 打开eclipse>Help>Eclipse Matketplace 打开 Eclipse Marketplace 搜索 spotbugs,点击Insta ...
- 洛谷 P3119 [USACO15JAN]草鉴定Grass Cownoisseur (SCC缩点,SPFA最长路,枚举反边)
P3119 [USACO15JAN]草鉴定Grass Cownoisseur 题目描述 In an effort to better manage the grazing patterns of hi ...
- 类的命名空间与卸载详解及jvisualvm使用
类的命名空间详解: 在上一次[https://www.cnblogs.com/webor2006/p/9108301.html]最后实验中有一个违背咱们理解的,这里回顾一下: 也就是说,"某 ...
- 08—mybatis注解配置二
动态sql mybatis的注解也支持动态sql.mybatis提供了各种注解,如@InsertProvider.@UpdateProvider.@DeleteProvider和@SelectProv ...