关键词:
主题: 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 [[email protected] nginx-1.8.0]# pwd /root/develop/nginx-1.8.0 [[email protected] 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方式: [[email protected] 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方式: [[email protected] /]# 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. [[email protected] 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 [[email protected] 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. [[email protected] nginx-1.8.0]# yum list installed | grep zlib zlib.i686 1.2.3-29.el6 @anaconda-CentOS-201508042139.i386/6.7 搜索zlib-devel包: [[email protected] 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包: [[email protected] 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包: [[email protected] 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" [[email protected] sbin]# ./nginx nginx: [emerg] mkdir() "/var/temp/nginx/client" failed (2: No such file or directory) 执行命令目录为: /usr/local/nginx/sbin 启动nginx: [[email protected] ~]# cd /usr/local/nginx/ [[email protected] nginx]# ls conf html sbin [[email protected] nginx]# cd sbin [[email protected] sbin]# ls nginx [[email protected] sbin]# ./nginx 启动后查看进程: 示例:# ps aux | grep nginx [[email protected] 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 [[email protected] 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 [[email protected] 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 错误示例: [[email protected] sbin]# ./nginx -s exit nginx: invalid option: "-s exit" 重启nginx: 示例:./nginx -s reload 执行命令目录为: /usr/local/nginx/sbin
glEnd 错误 (mesa-libGL/GLU) 在 Centos6.7 上安装“rgl”包
】glEnd错误(mesa-libGL/GLU)在Centos6.7上安装“rgl”包【英文标题】:glEnderror(mesa-libGL/GLU)installing"rgl"packageonCentos6.7【发布时间】:2016-07-2806:29:27【问题描述】:我尝试在CentOS6.7上安装“rgl”,但无法正常工作。看到许多类似的... 查看详情
centos6.7安装python2.7(代码片段)
安装开发包#安装必要的开发包yumgroupinstall"DevelopmentTools"#安装必要的支持包yuminstallzlib-developenssl-develreadline-develbzip2-develsqlite-devel下载并安装python2.7Python2.7cdPython-2.7.15./configuremakemakeinstall下载 查看详情
centos6.7安装docker1.7.1
...列安装方法。如果我们想在低于3.x内核的操作系统(比如Centos6.7)上装Docker最新版,势必要升级内核。但是想要在Centos6.7上安装可以安装较低版本的Docker。事实上,对于内核版本要大于3.10这个要求,是从Docker1.8.2版本开始的,Doc... 查看详情
centos6.7下安装kvm
首先说下KVM是什么?KVM是指基于linux内核的虚拟机(Kernel-baseVirtualMachine)。这儿提到了虚拟化。虚拟化是云计算的基础,它使得我们可以在一台物理服务器上跑多台虚拟机。各个虚拟机共享物理机的CPU、内存、IO硬件等资源。但... 查看详情
centos6.7上yum安装jdk1.8的java_home
今天问题还挺多,在VMware上安装Btrace时遇到的,Btrace需要读服务器的JAVA_HOME,当时我配置的是JAVA_HOME=/usr(我以为java命令所在的目录就是JAVA_HOME,真是二的可以),怎么起不来,报错如下:Causedby:java.lang.ClassNotFoundException:com.sun.sourc... 查看详情
centos6.7安装python2.7(代码片段)
安装开发包#安装必要的开发包yumgroupinstall"DevelopmentTools"#安装必要的支持包yuminstallzlib-developenssl-develreadline-develbzip2-develsqlite-devel下载并安装python2.7Python2.7cdPython-2.7.15./configuremakemakeinstall下载并安装pippip其他问题python2.7Retrying... 查看详情
在centos6.7操作系统上编译安装httpd2.4
功能描述: 在CentOS6.7操作系统上,编译安装apache服务,实现定制功能等一、安装前提 1)安装编译httpd需要的软件包 [[email protected]~]# yum-yinstallwgetgcc-c++ncursesncurses-develcmakemakeperlbisonopensslopenssl-develgcc*libxm 查看详情
在centos6.7操作系统上编译安装mysql-5.6.31
功能概述: 由于在centos6.7下通过yum安装的mysql是5.1版本的,不满足需求,因此经常性需要编译安装mysql服务等。一、安装mysql 1、安装前提 1)安装编译mysql代码所依赖的包 [[email protected]~]#yum-yi... 查看详情
centos6/7中通过yum安装软件时提示cannotfindavalidbaseurl...的解决方法(代码片段)
目录1问题描述2解决方法一(CentOS7中有效)3解决方法二(CentOS7中无效)1问题描述新申请了虚拟机,系统版本是CentOS7.2.在安装软件的过程中,发现yum命令不能连接到远程仓库,出现如下提示:[[email protected]~]#yuminstall-yvim[[email protected... 查看详情
centos6.7安装(虚拟机)
centos6/7安装ffmpeg
环境 CentOS6/7 安装导入GPGkeyrpm--importhttp://packages.atrpms.net/RPM-GPG-KEY.atrpms安装ATRPMSReporpm-ivhhttp://dl.atrpms.net/all/atrpms-repo-6-7.el6.x86_64.rpm选择ATRPMSRepo安装ffmpegyum-y--enablerepo=atr 查看详情
centos6/7快捷使用gcc5(代码片段)
Centos6/7自带的gcc为4.x版本,可通过devtoolset工具集安装gcc5.x版本1.添加yum源 1)CentOS6[hhorak-devtoolset-4-rebuild-bootstrap2]name=Coprrepofordevtoolset-4-rebuild-bootstrap2ownedbyhhorakbaseurl=https://copr-be 查看详情
centos6/7安装ss代理
本文仅做技术探讨,请在遵守相应的法律法规的前提下使用。******************************************************************************************************************************************************************一键安装脚本cento 查看详情
centos6.7安装openblas错误
centos系统:CentOSrelease6.7(Final)安装OpenBLAS#InstallOpenBLASat/usr/local/openblasgitclonehttps://github.com/xianyi/OpenBLAScdOpenBLASmake-j$(($(nproc)+1))sudomakePREFIX=/usr/localinstallcd..执行命令:make-j$ 查看详情
graylog部署(centos6/7+mongodb3*+graylog3.2+elasticsearch6*)(代码片段)
CentOS6或7或更高都可以1.安装MongoDB手动建立mongodbrepo源,如果没有安装vim,则先执行yuminstallvim在线安装mongodbvim/etc/yum.repos.d/mongodb-org-3.6.repo配置如下[mongodb-org-3.6]name=MongoDBRepositorybaseurl=https://repo. 查看详情
centos6.7安装mysqltomcatjdkredis
1.mysql安装http://blog.csdn.net/xxd851116/article/details/22947891(自动安装)http://blog.csdn.net/bingjianit/article/details/54384299(自动安装出现的问题) 准备:yuminstalllrzszMySQL-client-5.6.29-1.linux_glibc2.5.x8 查看详情
centos6.7安装与配置vncserver
...理软件,可以实现图形化管理,下面简单介绍一下如何在centos6.7下安装vnc。 安装vncserver yuminstalltigervnctigervnc-server-y 配置vncserver vi/etc/sysconfig/vncserver 将文件中的下列两行的#号去掉#VNCSERVERS="2:myus 查看详情
centos6.7升级openssh版本(代码片段)
实现前提公司服务器需要进行安全测评,扫描漏洞的设备扫出了关于openssh漏洞,主要是因为openssh的当前版本为5.3,版本低了,而yum最新的openssh也只是5.3,没办法只能到rpm官网找新的包,找到最新的是6.4,然后通过yumlocalinstall升... 查看详情