CentOS6.9编译安装nginx1.4.7
1.系统安装开发包组和zlib-devel,关闭iptables
[root@bogon ~]# yum groupinstall -y "Development Tools"
[root@bogon ~]# yum install -y zlib-devel
[root@bogon ~]# yum install -y openssl
[root@bogon ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules:
2.下载nginx的源码包到本地
[root@bogon ~]# ll nginx-1.4.7.tar.gz
-rw-r--r--. 1 root root 769153 Jun 1 2017 nginx-1.4.7.tar.gz
3.解压nginx源码包
[root@bogon ~]# tar -xf nginx-1.4.7.tar.gz
4.进入解压目录
[root@bogon ~]# cd nginx-1.4.7
5.开始编译,生成makefile文件
[root@bogon nginx-1.4.7]# ./configure --prefix=/usr\ --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf\ --error-log-path=/var/log/nginx/error.log\ --http-log-path=/var/log/nginx/access.log\ --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock\ --user=nginx --group=nginx --with-http_flv_module\ --with-http_stub_status_module --with-http_gzip_static_module\ --http-client-body-temp-path=/var/tmp/nginx/client\ --http-proxy-temp-path=/var/tmp/nginx/proxy\ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/\ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi\ --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre\ --with-http_ssl_module\
.....
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
checking for PCRE library ... found
checking for PCRE JIT support ... not found
checking for OpenSSL library ... found
checking for zlib library ... found
creating objs/Makefile
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/usr"
nginx binary file: "/usr/sbin/nginx"
nginx configuration prefix: "/etc/nginx"
nginx configuration file: "/etc/nginx/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/tmp/nginx/client"
nginx http proxy temporary files: "/var/tmp/nginx/proxy"
nginx http fastcgi temporary files: "/var/tmp/nginx/fcgi/"
nginx http uwsgi temporary files: "/var/tmp/nginx/uwsgi"
nginx http scgi temporary files: "/var/tmp/nginx/scgi"
6.开始安装nginx
[root@bogon nginx-1.4.7]# make && make install
make -f objs/Makefile
make[1]: Entering directory `/root/nginx-1.4.7'
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/nginx.o \
src/core/nginx.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_log.o \
src/core/ngx_log.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_palloc.o \
src/core/ngx_palloc.c
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
-o objs/src/core/ngx_array.o \
src/core/ngx_array.c
....
make[1]: Leaving directory `/root/nginx-1.4.7'
make -f objs/Makefile manpage
make[1]: Entering directory `/root/nginx-1.4.7'
sed -e "s|%%PREFIX%%|/usr|" \
-e "s|%%PID_PATH%%|/var/run/nginx/nginx.pid|" \
-e "s|%%CONF_PATH%%|/etc/nginx/nginx.conf|" \
-e "s|%%ERROR_LOG_PATH%%|/var/log/nginx/error.log|" \
< man/nginx.8 > objs/nginx.8
make[1]: Leaving directory `/root/nginx-1.4.7'
make -f objs/Makefile install
make[1]: Entering directory `/root/nginx-1.4.7'
test -d '/usr' || mkdir -p '/usr'
test -d '/usr/sbin' || mkdir -p '/usr/sbin'
test ! -f '/usr/sbin/nginx' || mv '/usr/sbin/nginx' '/usr/sbin/nginx.old'
cp objs/nginx '/usr/sbin/nginx'
test -d '/etc/nginx' || mkdir -p '/etc/nginx'
cp conf/koi-win '/etc/nginx'
cp conf/koi-utf '/etc/nginx'
cp conf/win-utf '/etc/nginx'
test -f '/etc/nginx/mime.types' || cp conf/mime.types '/etc/nginx'
cp conf/mime.types '/etc/nginx/mime.types.default'
test -f '/etc/nginx/fastcgi_params' || cp conf/fastcgi_params '/etc/nginx'
cp conf/fastcgi_params '/etc/nginx/fastcgi_params.default'
test -f '/etc/nginx/fastcgi.conf' || cp conf/fastcgi.conf '/etc/nginx'
cp conf/fastcgi.conf '/etc/nginx/fastcgi.conf.default'
test -f '/etc/nginx/uwsgi_params' || cp conf/uwsgi_params '/etc/nginx'
cp conf/uwsgi_params '/etc/nginx/uwsgi_params.default'
test -f '/etc/nginx/scgi_params' || cp conf/scgi_params '/etc/nginx'
cp conf/scgi_params '/etc/nginx/scgi_params.default'
test -f '/etc/nginx/nginx.conf' || cp conf/nginx.conf '/etc/nginx/nginx.conf'
cp conf/nginx.conf '/etc/nginx/nginx.conf.default'
test -d '/var/run/nginx' || mkdir -p '/var/run/nginx'
test -d '/var/log/nginx' || mkdir -p '/var/log/nginx'
test -d '/usr/html' || cp -R html '/usr'
test -d '/var/log/nginx' || mkdir -p '/var/log/nginx'
make[1]: Leaving directory `/root/nginx-1.4.7'
7.测试nginx的配置语法
#查看nginx的帮助
[root@bogon nginx-1.4.7]# /usr/sbin/nginx -h
nginx version: nginx/1.4.7
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]
Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/)
-c filename : set configuration file (default: /etc/nginx/nginx.conf)
-g directives : set global directives out of configuration file
#测试配置文件的语法
[root@bogon nginx-1.4.7]# /usr/sbin/nginx -t
#显示语法正确
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
#显示系统上没有nginx这个用户
nginx: [emerg] getpwnam("nginx") failed
#配置文件测试失败
nginx: configuration file /etc/nginx/nginx.conf test failed
8.添加nginx这个系统用户,然后测试配置文件语法
#添加nginx这个系统用户
[root@bogon nginx-1.4.7]# useradd -r nginx
#测试配置文件语法
[root@bogon nginx-1.4.7]# /usr/sbin/nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
#显示/var/tmp/nginx这个临时目录不存在
nginx: [emerg] mkdir() "/var/tmp/nginx/client" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
9.建立nginx的临时目录,然后测试配置文件的语法
#建立nginx临时目录
[root@bogon nginx-1.4.7]# mkdir /var/tmp/nginx
[root@bogon nginx-1.4.7]# /usr/sbin/nginx -t
#显示nginx配置文件语法正确
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
#测试nginx配置文件成功
nginx: configuration file /etc/nginx/nginx.conf test is successful
10.启动nginx
#启动nginx
[root@bogon nginx-1.4.7]# /usr/sbin/nginx
#查看是否启动成功
[root@bogon nginx-1.4.7]# ss -tnl | grep 80
LISTEN 0 128 *:80 *:*
11.查看系统IP地址,打开nginx的本地网页
[root@bogon ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:9C:2B:A5
inet addr:192.168.16.87 Bcast:192.168.16.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe9c:2ba5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1648500 errors:0 dropped:0 overruns:0 frame:0
TX packets:2193 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1606718906 (1.4 GiB) TX bytes:176876 (172.7 KiB)
CentOS6.9编译安装nginx1.4.7的更多相关文章
- CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28
[准备工作] #在编译安装lnmp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove httpd yum -y r ...
- CentOS6.9编译安装Nginx1.12
1:安装必要的库 Bash yum install gc gcc gcc-c++ pcre-devel zlib-devel openssl-devel 2:创建Nginx用户和组 Bash grou ...
- CentOS6.5编译安装Nginx1.8.1+MySQL5.5.48+PHP5.2.17+xcache3.2+ZendOptimizer-3.3.9
一.安装Nginx: 1.解决依赖关系 编译安装nginx需要事先需要安装开发包组"Development Tools"和 "Development Libraries& ...
- 【PHP升级】CentOS6.3编译安装 PHP5.4.38
先前安装的PHP5.3.28(参考:CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28),现在准备升级PHP到5.4.38,有如下几个地方需要重新编译 ...
- Centos6.4_X64编译安装php-5.4.17、nginx-1.4.2、mysql-5.6.13
安装参考: CentOS 6.3编译安装Nginx1.2.2+MySQL5.5.25a+PHP5.4.5 http://www.dedecms.com/knowledge/servers/linux- ...
- centos6.6编译安装lnmp系列之mysql
简介: 环境:虚拟机+centos6.6 Mysql版本:5.6.21 Mysql下载地址:http://cdn.mysql.com/archives/mysql-5.6/mysql-5.6.21.t ...
- CentOS6.7上安装nginx1.8.0
主题: CentOS6.7上安装nginx1.8.0 环境准备: 1.gcc-c++ 示例:yum install gcc-c++ 安装:gcc-c++ gcc-c++编译工具 2.PCRE(Perl ...
- 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. ...
- CentOS7 编译安装 nginx-1.10.0
对于NGINX 支持epoll模型 epoll模型的优点 定义: epoll是Linux内核为处理大批句柄而作改进的poll,是Linux下多路复用IO接口select/poll的增强版本,它能显著的 ...
随机推荐
- html笔记2
html css的用法 <style type="text/css">代表我要使用css了 <html> <head> <style ty ...
- 基于Windows下python3.4.1IDLE常用快捷键小结
安装IDLE后鼠标右键点击*.py 文件,可以看到Edit with IDLE 选择这个可以直接打开编辑器.IDLE默认不能显示行号,使用ALT+G 跳到对应行号,在右下角有显示光标所在行.列.ALT ...
- node & grunt path处理相关
在nodejs平台上写一些工具或者服务, 有很多需求会涉及到对目录或者文件路径的处理和操作.整理一些常用的处理path的方法 1.global __dirname Example: running n ...
- java 静态导入 小结
之前看过静态导入这一块,在编程思想里,但是记不清了,今天搜了下,看到有一个博文写的不错,所以留做备注吧 总结: import static xxx.xxx 和普通导入的区别在于,普通导入是需要通过& ...
- 局域网内一台电脑的ip地址自己会变,怎样让它不变
有两种方法可以让局域网内的电脑拥有固定的ip地址: 方法一:使用DHCP的静态地址分配功能(以TP-Link TL-WR847路由器为例). 打开浏览器,输入路由器LAN口的ip地址和管理员用户名.密 ...
- 【编程技巧】 iOS 5的StoryBoard(故事板)的一些用法
从StroyBoard得到一个View UIViewController *viewController = [[UIStoryboard storyboardWithName:@"Main ...
- ios 积累
1.加号 是可以通过类名直接调用这个方法,而减号则要实例化逸个对象,然后通过实例化的对象来调用该方法!! 2.(返回类型) 方法名 :(参数类型)变量名 空格 参数二名 :(参数类型) 变量名 空格 ...
- 谷歌扩展程序设置ajax请求允许跨域(极少人知道的解决方案)
前言: 跨域问题一直是个老生常谈的问题,在实际开发过程中,跨域的问题常常会让开发者非常的头疼. 常用的几种跨域解决方案: 1.代理 2.XHR2 HTML5中提供的XMLHTTPREQUEST Lev ...
- 关于ls命令的实例
生活映射程序---------科技创造生活 ls 是Linux的常用命令之一直接使用 ls 命令的话只会列出对应的文件名ls -l 命令会显示文件和目录,包括文件类型,大小,修改日期和时间,权限信息等 ...
- python_判断变量类型
需求: 已知有一个变量,我想对他进行预处理判断,如果这个变量是字符串,则在字符串后面加上后缀'_str',如果整形就让其加5,还比如我要求这个变量是整形或者字符串,都行 如何做? #!/usr/bin ...