编译安装 nginx -1.14.2

1 ) 下载nginx-1.14.2 源码包:

wget http://nginx.org/download/nginx-1.14.2.tar.gz

2 ) 编译安装 nginx:

 ### 1 )  安装nginx 编译的依赖包(基本需要这3类的devel包,其他缺少的包自行解决报错):
yum install pcre pcre-devel openssl openssl-devel zlib zlib-devel -y ### 2 ) 解压并安装nginx(注意定制的安装路径根据自己的需求自行更改 ):
tar -zxvf nginx-1.14.2.tar.gz && cd nginx-1.14.2/ ### 3 ) 编译安装nginx:
./configure --prefix=/data/nginx --http-client-body-temp-path=/data/nginx/cache/nginx/client_temp --http-proxy-temp-path=/data/nginx/cache/nginx/proxy_temp --http-fastcgi-temp-path=/data/nginx/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/data/nginx/cache/nginx/uwsgi_temp --http-scgi-temp-path=/data/nginx/cache/nginx/scgi_temp --user=fmw --group=fmw --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-pcre --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' make && make install ### 4 ) 添加环境变量到系统:
vim /etc/profile.d/nginx.sh PATH=$PATH:/data/nginx/bin/:/data/nginx/sbin
export PATH source /etc/profile

3 ) 添加启动脚本(centos 7 ):

### 3.1 编写nginx启动脚本:
[root@localhost ~]# vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target [Service]
Type=forking
ExecStart=/data/nginx/sbin/nginx
ExecReload=/data/nginx/sbin/nginx -s reload
ExecStop=/data/nginx/sbin/nginx -s quit
PrivateTmp=true
#EnvironmentFile=/etc/sysconfig/rdisc
#ExecStart=/sbin/rdisc $RDISCOPTS [Install]
WantedBy=multi-user.target ### 3.2 添加开启启动:
systemctl enable nginx ### 3.3 查看nginx服务状态:
systemctl start nginx
systemctl status nginx

4 ) nginx 主要配置文件:

grep -vE '^#|^$|^     #' nginx.conf

user  fmw fmw;                     # 运行nginx的用户组和用户.
worker_processes auto; # 使用的CPU内核.
error_log logs/error.log notice; # nginx 错误日志的存放路径和日志级别.
pid logs/nginx.pid; # PID 路径.
events {
use epoll; # 使用的网络模型select,epoll,
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name www.188faka.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.php index.html index.htm;
}
error_page 404 /404/404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
} server {
listen 443 ssl;
server_name www.188faka.com;
ssl_certificate /data/nginx/conf/188kafa_ssl/188faka.crt;
ssl_certificate_key /data/nginx/conf/188kafa_ssl/188faka.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.php index.html index.htm;
}
error_page 404 /404/404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}

编译安装 nginx -1.14.2的更多相关文章

  1. Centos7 编译安装 Nginx Mariadb Asp.net Core2 (实测 笔记 Centos 7.3 + Openssl 1.1.0h + Mariadb 10.3.7 + Nginx 1.14.0 + Asp.net. Core 2 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  2. ubuntu 14.04 编译安装 nginx

    下载源码包 nginx 地址:http://nginx.org/en/download.html  下载nginx 1.4.7 编译前先安装两个包: 直接编译安装会碰到缺少pcre等问题,这时候只要到 ...

  3. centos系统编译安装nginx+php环境另加独立mysql教程

    以前看过的安装nginx+php环境都带了mysql数据库了,这个是因为很多站长都是nginx+php+mysql都在同一台服务器了,那么今天我们是单独处理了,一个是nginx+php环境,然后mys ...

  4. Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Mariadb 10.1.20 + Nginx 1.10.2 + PHP 7.1.0 + Laravel 5.3 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  5. CentOS7 编译安装 Nginx (实测 笔记 Centos 7.0 + nginx 1.6.2)

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...

  6. ubuntu 12.04 编译安装 nginx

    下载源码包 nginx 地址:http://nginx.org/en/download.html 编译前先安装两个包: 直接编译安装会碰到缺少pcre等问题,这时候只要到再安装两个包就ok sudo ...

  7. Centos7 编译安装 Nginx PHP Mariadb Memcached 扩展 ZendOpcache扩展 (实测 笔记 Centos 7.3 + Openssl 1.1.0e + Mariadb 10.1.22 + Nginx 1.12.0 + PHP 7.1.4 + Laravel 5.4 )

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...

  8. Centos7 编译安装 Nginx PHP Mariadb Memcache扩展 ZendOpcache扩展 (实测 笔记 Centos 7.0 + Mariadb 10.1.9 + Nginx 1.9.9 + PHP 5.5.30)

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1503-01.iso 安装步骤: 1.准备 1.1 ...

  9. Centos7 编译安装 Nginx、MariaDB、PHP

    前言 本文主要大致介绍CentOS 7下编译安装Nginx.MariaDB.PHP.面向有Linux基础且爱好钻研的朋友.技艺不精,疏漏再所难免,还望指正. 环境简介: 系统: CentOS 7,最小 ...

随机推荐

  1. tcp/ip原理/三次握手/四次挥手

    @ tcp/ip原理 1.1 tcp/ip三次握手 1.1.1 建立过程说明 a)   由主机A发送建立TCP连接的请求报文, 其中报文中包含seq序列号, 是由发送端随机生成的, 并且还将报文中SY ...

  2. ab test压力测试

    之前做性能调试的时候一直用的JMeter压测,最近发现一款简单易用的压力测试工具. ab(Apache benchmark)是一款常用的压力测试工具,是Apache附带的一个小工具 , 专门用于HTT ...

  3. C++将整型值转换为字符串

    最简单的方法是使用一个字符串流(stringstream):#include<iostream>#include<string>#include<sstream>u ...

  4. 容器编排系统之Pod生命周期、健康/就绪状态探测以及资源限制

    前文我们了解了在k8s上的资源标签.标签选择器以及资源注解相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/14141080.html:今天我们来聊下k8 ...

  5. 【QT】多个槽函数绑定同一个信号的触发顺序

    目录 一.Qt 3.0(包含3.0) - Qt 4.5(包含4.5)版本之前 二.Qt 4.6(包含4.6)版本之后 一.Qt 3.0(包含3.0) - Qt 4.5(包含4.5)版本之前 「多个槽函 ...

  6. C# 托管与非托管类型 堆和栈 值类型与引用类型 装箱与拆箱

    一.托管类型与非托管类型 1.托管类型 托管类型包括 引用类型 以及 包含有引用类型或托管类型成员的结构. 引用类型 含引用类型或托管类型成员(字段.自动实现 get 访问器的属性)的结构 // 托管 ...

  7. 二、LINUX文本处理三剑客之grep

    1. grep一般格式:grep [选项] 基本正则表达式 [文件],其中基本正则表达式需要用引号引起来 引号引起来的作用:a.防止被误解为shell命令,b.可以用来查找多个单词组成的字符串 gre ...

  8. Next.js+React聊天室|Next仿微信桌面端|next.js聊天实例

    一.项目介绍 next-webchat 基于Next.js+React.js+Redux+Antd+RScroll+RLayer等技术构建的PC桌面端仿微信聊天项目.实现了消息/表情发送.图片/视频预 ...

  9. JAVA中IO流详解

    IO流:数据传输是需要通道的,而IO流就是数据传输的通道. IO流可以形象的比喻为运送货物的传输带. IO流的分类: ①根据操作的数据类型的不同可以分为 :字节流与字符流. ②根据数据的流向分为:输入 ...

  10. 看完这篇,保证让你真正明白:分布式系统的CAP理论、CAP如何三选二

    引言 CAP 理论,相信很多人都听过,它是指: 一个分布式系统最多只能同时满足一致性(Consistency).可用性(Availability)和分区容错性(Partition tolerance) ...