主题:
CentOS6.7上安装nginx1.8.0 环境准备:
1.gcc-c++
示例:yum install gcc-c++
安装:gcc-c++
gcc-c++编译工具 2.PCRE(Perl Compatible Regular Expressions)
示例:yum install -y pcre pcre-devel
安装:pcre和pcre-devel PCRE(Perl Compatible Regular Expressions)是一个 Perl 库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库。pcre-devel 是使用 pcre 开发的一个二次开发库。nginx 也需要此库。 3.zlib
示例:yum install -y zlib zlib-devel
安装:zlib和zlib-devel 4.OpenSSL
示例:yum install -y openssl openssl-devel
安装:openssl和openssl-devel OpenSSL是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用。nginx 不仅支持 http 协议,还支持 https(即在 ssl 协议上传输 http),所以需要在 linux安装 openssl 库 安装步骤:
在nginx解压目录中,./configure&make&make install 压缩包存放:
/root/develop/
解压目录:
/root/develop/nginx-1.8.0 [root@heima01 nginx-1.8.0]# pwd
/root/develop/nginx-1.8.0
[root@heima01 nginx-1.8.0]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src 配置帮助:
1.help方式
示例:# ./configure --help
2.info方式
示例:# info configure help方式:
[root@heima01 nginx-1.8.0]# ./configure --help --help print this message --prefix=PATH set installation prefix
--sbin-path=PATH set nginx binary pathname
--conf-path=PATH set nginx.conf pathname
--error-log-path=PATH set error log pathname
--pid-path=PATH set nginx.pid pathname
--lock-path=PATH set nginx.lock pathname --user=USER set non-privileged user for
worker processes
--group=GROUP set non-privileged group for
worker processes --build=NAME set build name
--builddir=DIR set build directory info方式:
[root@heima01 /]# info configure File: configure.info, Node: Top, Next: Introduction, Up: (dir) GNU configure and build system
****************************** The GNU configure and build system. * Menu: * Introduction:: Introduction.
* Getting Started:: Getting Started.
* Files:: Files.
* Configuration Names:: Configuration Names.
* Cross Compilation Tools:: Cross Compilation Tools.
* Canadian Cross:: Canadian Cross.
* Cygnus Configure:: Cygnus Configure.
* Multilibs:: Multilibs.
* FAQ:: Frequently Asked Questions.
* Index:: Index. configure参数:
./configure \
--prefix=/usr \                                                        指向安装目录
--sbin-path=/usr/sbin/nginx \                                 指向(执行)程序文件(nginx)
--conf-path=/etc/nginx/nginx.conf \                      指向配置文件
--error-log-path=/var/log/nginx/error.log \              指向log
--http-log-path=/var/log/nginx/access.log \            指向http-log
--pid-path=/var/run/nginx/nginx.pid \                      指向pid
--lock-path=/var/lock/nginx.lock \                         (安装文件锁定,防止安装文件被别人利用,或自己误操作。)
--user=nginx \
--group=nginx \
--with-http_ssl_module \                      启用ngx_http_ssl_module支持(使支持https请求,需已安装openssl)
--with-http_flv_module \                       启用ngx_http_flv_module支持(提供寻求内存使用基于时间的偏移量文件)
--with-http_stub_status_module \     启用ngx_http_stub_status_module支持(获取nginx自上次启动以来的工作状态)
--with-http_gzip_static_module \   启用ngx_http_gzip_static_module支持(在线实时压缩输出数据流)
--http-client-body-temp-path=/var/tmp/nginx/client/ \ 设定http客户端请求临时文件路径
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \ 设定http代理临时文件路径
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ 设定http fastcgi临时文件路径
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ 设定http uwsgi临时文件路径
--http-scgi-temp-path=/var/tmp/nginx/scgi \ 设定http scgi临时文件路径
--with-pcre 启用pcre库 实际使用的configure参数:
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi 问题:
描述:系统需要安装PCRE library
方案:安装pcre-devel
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option. [root@heima01 nginx-1.8.0]# yum search pcre
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.cqu.edu.cn
* extras: mirrors.cn99.com
* updates: mirrors.163.com
================================================================================ N/S Matched: pcre =================================================================================
pcre-devel.i686 : Development files for pcre
pcre-static.i686 : Static library for pcre
pcre.i686 : Perl-compatible regular expression library [root@heima01 nginx-1.8.0]# yum install pcre-devel.i686
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.zju.edu.cn
* extras: mirrors.cn99.com
* updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package pcre-devel.i686 0:7.8-7.el6 will be installed
--> Finished Dependency Resolution 问题:
描述:HTTP gizp模块需要zlib库
方案:安装zlib-devel
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option. [root@heima01 nginx-1.8.0]# yum list installed | grep zlib
zlib.i686 1.2.3-29.el6 @anaconda-CentOS-201508042139.i386/6.7 搜索zlib-devel包:
[root@heima01 nginx-1.8.0]# yum search zlib
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.cqu.edu.cn
* extras: mirrors.cn99.com
* updates: mirrors.163.com
================================================================================ N/S Matched: zlib =================================================================================
jzlib.i686 : JZlib re-implementation of zlib in pure Java
jzlib-demo.i686 : Examples for jzlib
jzlib-javadoc.i686 : Javadoc for jzlib
perl-Compress-Raw-Zlib.i686 : Low-Level Interface to the zlib compression library
perl-Compress-Zlib.i686 : A module providing Perl interfaces to the zlib compression library
perl-IO-Zlib.i686 : Perl IO:: style interface to Compress::Zlib
zlib.i686 : The zlib compression and decompression library
zlib-devel.i686 : Header files and libraries for Zlib development
zlib-static.i686 : Static libraries for Zlib development
perl-IO-Compress-Zlib.i686 : Perl interface to allow reading and writing of gzip and zip data 安装zlib-devel包:
[root@heima01 nginx-1.8.0]# yum install -y zlib-devel.i686
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.cqu.edu.cn
* extras: mirrors.cn99.com
* updates: mirrors.163.com
Resolving Dependencies
--> Running transaction check
---> Package zlib-devel.i686 0:1.2.3-29.el6 will be installed
--> Finished Dependency Resolution 查看是否安装了zlib-devel包:
[root@heima01 nginx-1.8.0]# yum list installed | grep zlib
Existing lock /var/run/yum.pid: another copy is running as pid 6999.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: PackageKit
Memory : 25 M RSS ( 72 MB VSZ)
Started: Wed May 29 05:29:04 2019 - 00:06 ago
State : Sleeping, pid: 6999
zlib.i686 1.2.3-29.el6 @anaconda-CentOS-201508042139.i386/6.7
zlib-devel.i686 1.2.3-29.el6 @base ./configure执行结果:
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ using builtin md5 code
+ sha1 library is not found
+ using system zlib library nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/var/run/nginx/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/var/temp/nginx/client"
nginx http proxy temporary files: "/var/temp/nginx/proxy"
nginx http fastcgi temporary files: "/var/temp/nginx/fastcgi"
nginx http uwsgi temporary files: "/var/temp/nginx/uwsgi"
nginx http scgi temporary files: "/var/temp/nginx/scgi" [root@heima01 sbin]# ./nginx
nginx: [emerg] mkdir() "/var/temp/nginx/client" failed (2: No such file or directory) 执行命令目录为:
/usr/local/nginx/sbin 启动nginx:
[root@heima01 ~]# cd /usr/local/nginx/
[root@heima01 nginx]# ls
conf html sbin
[root@heima01 nginx]# cd sbin
[root@heima01 sbin]# ls
nginx
[root@heima01 sbin]# ./nginx 启动后查看进程:
示例:# ps aux | grep nginx
[root@heima01 nginx-1.8.0]# ps aux | grep nginx
root 3000 0.0 0.0 3200 524 ? Ss 04:45 0:00 nginx: master process ./nginx
nobody 3001 0.0 0.1 3404 1184 ? S 04:45 0:00 nginx: worker process
root 3230 0.0 0.0 4420 760 pts/2 S+ 05:14 0:00 grep nginx 查看防火墙过滤规则:
示例:# service iptables status [root@heima01 nginx-1.8.0]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3306
4 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
5 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
6 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
8 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited 查看网络监听:
示例:# netstat -ntlp [root@heima01 nginx-1.8.0]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1585/rpcbind
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3000/nginx
tcp 0 0 0.0.0.0:43315 0.0.0.0:* LISTEN 1642/rpc.statd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1832/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1681/cupsd
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 2746/sshd
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 2970/sshd
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 2797/java
tcp 0 0 :::8009 :::* LISTEN 2797/java
tcp 0 0 :::3306 :::* LISTEN 1990/mysqld
tcp 0 0 :::111 :::* LISTEN 1585/rpcbind
tcp 0 0 :::8080 :::* LISTEN 2797/java
tcp 0 0 :::22 :::* LISTEN 1832/sshd
tcp 0 0 ::1:631 :::* LISTEN 1681/cupsd
tcp 0 0 ::1:6010 :::* LISTEN 2746/sshd
tcp 0 0 ::1:6011 :::* LISTEN 2970/sshd
tcp 0 0 :::49662 :::* LISTEN 1642/rpc.statd 关闭nginx:
方式1:./nginx -s stop
方式2:./nginx -s quit 错误示例:
[root@heima01 sbin]# ./nginx -s exit
nginx: invalid option: "-s exit" 重启nginx:
示例:./nginx -s reload 执行命令目录为:
/usr/local/nginx/sbin

CentOS6.7上安装nginx1.8.0的更多相关文章

  1. centos6.5上安装Openfire 4.0.3

    更新时间:2016年11月9日 00:18:27 博主的安装环境 物理机:        Win7 SP1 64位 ip:192.168.111.1    (用于安装spark 2.8.1) VM虚拟 ...

  2. centos6.x上安装Java-1.8.0

    author : headsen chen date : 2017-12-04  10:32:44 notice :This  article is created by headsen chen h ...

  3. centos6.5安装nginx1.16.0

    参考:   centos7 编译安装nginx1.16.0( 完整版 ) https://blog.csdn.net/weixin_37773766/article/details/80290939  ...

  4. CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14

    准备篇: CentOS 7.0系统安装配置图解教程 http://www.osyunwei.com/archives/7829.html 一.配置防火墙,开启80端口.3306端口 CentOS 7. ...

  5. CentOS7 编译安装 nginx-1.10.0

    对于NGINX 支持epoll模型 epoll模型的优点 定义: epoll是Linux内核为处理大批句柄而作改进的poll,是Linux下多路复用IO接口select/poll的增强版本,它能显著的 ...

  6. 最新版CentOS6.5上安装部署ASP.NET MVC4和WebApi

    最新版CentOS6.5上安装部署ASP.NET MVC4和WebApi 使用Jexus5.8.1独立版 http://www.linuxdot.net/ ps:该“独立版”支持64位的CentOS ...

  7. CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13+博客系统WordPress3.3.2

    说明: 操作系统:CentOS 6.2 32位 系统安装教程:CentOS 6.2安装(超级详细图解教程): http://www.osyunwei.com/archives/1537.html 准备 ...

  8. CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享

    一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop fi ...

  9. 在CentOS6的上安装Windows2012R2的KVM虚拟机

    在CentOS6的上安装Windows2012R2的KVM虚拟机 1:上传cn_windows_server_2012_r2_vl_with_update_x64_dvd_6052729.iso下载驱 ...

随机推荐

  1. DOM (文档对象模型(Document Object Model)

    DOM(文档对象模型(Document Object Model) 文档对象模型(Document Object Model,简称DOM),是W3C组织推荐的处理可扩展标志语言的标准编程接口.在网页上 ...

  2. Java的访问权限修饰符

    default或者friendly表示默认的访问权限修饰符.

  3. L87

    Fear Makes Art More Engaging Emmanuel Kant spoke often about the sublime, and specifically how art b ...

  4. Wireshark 的使用 —— 过滤器(filter)

    1. 基本 ip 地址: 目的IP:ip.dst==192.168.101.8,源ip:ip.src==1.1.1.1 不区分源和目的:ip.addr == 192.168.101.8: 端口过滤: ...

  5. 每天一个linux命令(4):pwd命令

    版权声明更新:2017-05-08博主:LuckyAlan联系:liuwenvip163@163.com声明:吃水不忘挖井人,转载请注明出处! 1 文章介绍 本文介绍了Linux下命令cd. 2 开发 ...

  6. <十五>UML核心视图动态视图之活动图

    一:动态视图 --->动态视图是描述事物动态行为的. --->需要注意的是:动态视图不能够独立存在,它必需特指一个静态视图活uml元素,说明在静态视图规定的事物结构下它们的动态行为. -- ...

  7. BZOJ3230 相似子串[后缀数组+二分+st表]

    BZOJ3230 相似子串 给一个串,查询排名i和j的子串longest common suffix和longest common prefix 思路其实还是蛮好想的,就是码起来有点恶心.可以发现后缀 ...

  8. 微信开放平台搭建之EasyWeChat

    背景 公司有一个产品,需要用到微信授权登录及微信消息推送等功能.本来能够简单的使用公众号的接口将appid和appsecrect等信息写到配置文件里,但是作为一个产品化的东西,从体验等各方面来讲都不能 ...

  9. Python3解leetcode Single Number

    问题描述: Given a non-empty array of integers, every element appears twice except for one. Find that sin ...

  10. JS---分解质因数

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...