编译安装和apt安装Nginx1.14.0
安装依赖
yum -y install gcc gcc-c++yum -y install zlib zlib-devel openssl openssl-devel pcre-devel
在Ubuntu 下, 对应openssl-devel的包是 libssl-dev
建立用户及用户组
groupadd -r nginx
# -r 表示创建的是系统组
useradd -s /sbin/nologin -g nginx -r nginx
# -r 表示创建的是系统用户
id nginx
# 即使用其他用户启动nginx, 也必须创建nginx用户和用户组, 否则会出现 nginx: [emerg] getpwnam("nginx") failed 错误
编译和安装
./configure --prefix=/opt/nginx/nginx-1.14. --user=nginx --group=nginx --with-http_gzip_static_module --with-pcre --with-http_ssl_module --with-http_flv_module --with-stream --with-stream_ssl_module --with-http_stub_status_module
make
make install
建立latest目录和软链, 方便将来替换为新版本
cd /opt/nginx/
ln -s nginx-1.14. latest
配置
将nginx加入系统服务
cd /lib/systemd/system/
vi nginx.service # 内容 [Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target [Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/opt/nginx/latest/sbin/nginx -t -c /opt/nginx/latest/conf/nginx.conf
ExecStart=/opt/nginx/latest/sbin/nginx
ExecReload=/opt/nginx/latest/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true [Install]
WantedBy=multi-user.target # 内容结束 systemctl enable nginx.service
打开端口启动服务
firewall-cmd --zone=public --list-all
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload # 启动nginx
systemctl start nginx
Ubuntu18.04下apt安装Nginx1.14.0
Ubuntu18.04下默认的nginx版本就是1.14.0, 可以直接通过 sudo apt install nginx 安装. 安装后会自动加入service并启动, 可以通过 sudo systemctl list-unit-files 检查
默认的配置文件位于 /etc/nginx/nginx.conf, 这是给Ubuntu定制的配置文件, 基础配置部分, 会加载 /etc/nginx/modules-enabled/*.conf , 在 http 部分, 会自动加载 include /etc/nginx/conf.d/*.conf 和 include /etc/nginx/sites-enabled/*, 这样方便用户通过 modules-enabled, modules-available 和 sites-enabled, sites-available 来管理可用站点.
从这里开始配置就和编译安装的一样了.
编译安装和apt安装Nginx1.14.0的更多相关文章
- CentOS 安装Nginx1.14.0
原文地址:http://www.cnblogs.com/ascd-eg/p/9275441.html 一.安装所需环境 1.gcc 安装 yum install gcc-c++ ...
- CentOS7 安装nginx-1.14.0
nginx源码包:http://nginx.org/en/download.html 1.安装gcc gcc是用来编译下载下来的nginx源码 yum install gcc-c++ 2.安装pcre ...
- Centos7安装Nginx1.14.0
一.官网下载 http://nginx.org/en/download.html 版本说明: Nginx官网提供了三个类型的版本 Mainline version:Mainline 是 Nginx 目 ...
- nginx1.14.0下载、安装、启动
nginx1.14.0下载及安装 wget http://nginx.org/download/nginx-1.14.0.tar.gztar -zxvf nginx-1.14.0.tar.gzcd n ...
- elementaryos5安装mysql5.7、php7.2、nginx1.14.0
一.mysql5.7 安装mysql5.7: sudo apt-get install mysql-server-5.7 查看安装的mysql版本: mysql -V 5.7版本mysql安装过程中以 ...
- 安装 error: Microsoft Visual C++ 14.0 is required 解决方案
最近写的项目需要用到Python的第三方库,比如:mmh3, pyshark等等,而直接pip install ... 会报错:error: Microsoft Visual C++ 14.0 is ...
- Nginx1.14.0+ModSecurity实现简单的WAF
一.编译安装Nginx 1.安装依赖环境 $ yum -y install gcc-c++ flex bison yajl yajl-devel curl-devel curl GeoIP-devel ...
- nginx1.14.0版本https加密配置
修改host文件,为最后访问域名准备 C:\Windows\System32\drivers\etc host文件目录192.168.10.140 www.joyce.com 在最后添加这个自定义域名 ...
- nginx: [emerg] unknown directive "聽" in D:\software03\GitSpace\cms\nginx-1.14.0/conf/nginx.conf:36
nginx: [emerg] unknown directive "聽" in D:\software03\GitSpace\cms\nginx-1.14.0/conf/nginx ...
随机推荐
- freeswitch编译安装,初探, 以及联合sipgateway, webrtc server的使用场景。
本文主要记录freeswitch学习过程. 一 安装freeswitch NOTE 以下两种安装方式,再安装的过程中遇到了不少问题,印象比较深刻的就是lua库找到不到这个问题.这个问题发生在make ...
- tomcat的systemctl启动脚本
最近在做Tomcat的实验,顺便研究了一下tomcat的启动脚本发现一个问题,然后经过多方查阅其他大神的资料,终于解决,现在跟大家分享. tomcat的启动脚本跟别的脚本有稍微区别的原因是他需要识别J ...
- Thinkphph 使用RelationModel的三表关联查询机制
有如下三个表 a表 b表 c表id bid other id cid other id other a表的bid关联b表的id,b表的cid关联c表的id 现在需要查询a表的时候顺带把b表和c表的相关 ...
- mybatis分页插件PagePlugin
查询的参数对象里面继承PageInfoWrapper类(也可以不继承这个类,但要保证查询参数对象里面必须要有一个PageInfo属性) 分页信息都在PageInfo这个类里,查询的时候,分页参数,填充 ...
- 查找IDEA 项目中的依赖包存放在.m2位置
原因:在maven项目pom.xml中添加依赖,可能由于网络不好,下载不完全,导致再次下载一直报错. 就会导致出现依赖一直报错.
- 第 8 章 容器网络 - 071 - 如何定制 Calico 的 IP 池?
定制IP池 首先定义一个 IP Pool,比如: calicoctl create -f ipPool.yml 用此 IP Pool 创建 calico 网络. docker network crea ...
- 英语发音规则---E字母常见的发音组合有哪些
英语发音规则---E字母常见的发音组合有哪些 一.总结 一句话总结:很好记的e和5个元音字母的组合,加一个非e开头的ie e:开音节 /i:/ eve /i:v/ n. 夏娃----闭音节 /e/ ...
- word常用功能
1. 安装office2013 cn_office_professional_plus_2013_x86_dvd_1134005 密钥激活 (1)用专用软件彻底卸载原来的 (2)安装 (3)用暴风激活 ...
- Python自学:第三章 在列表末尾添加元素与在列表中插入元素
motorcycles = ['honda', 'yamaha' ,'suzuki'] motorcycles.insert(0, "ducati") print(motorcyc ...
- js中提示框闪退问题
当页面存在刷新 或 在线引用iframe框架时(引用框架也会导致刷新) 会导致页面加载时的弹出框闪退 解决方法:设置弹出框在页面或者框架完全加载一段时间后再弹出 <script type=& ...