码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx安装过程

时间:2016-12-07 02:43:35      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:linux

Nginx安装过程

linux版本系统

[root@amigo ~]# cat /etc/redhat-release

CentOS release 6.6 (Final)

[root@amigo ~]# uname -r

2.6.32-504.el6.x86_64

 

需要先关闭linux防火墙和selinux

关闭linux防火墙

[root@amigo nginx-1.6.3]# chkconfig iptables off

[root@amigo nginx-1.6.3]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter          [ OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

 

关闭selinx

[root@amigo etc]# vim /etc/selinux/config   

SELINUX=disabled

 

安装nginx依赖

[root@amigo ~]# yum install pcre pcre-devel  openssl openssl-devel

Loaded plugins: fastestmirror, security

Setting up Install Process

Loading mirror speeds from cached hostfile

 *base: mirrors.btte.net

 *extras: mirrors.nwsuaf.edu.cn

 *updates: mirrors.nwsuaf.edu.cn

Resolving Dependencies

--> Running transaction check

---> Package openssl.x86_640:1.0.1e-30.el6 will be updated

---> Package openssl.x86_640:1.0.1e-48.el6_8.3 will be an update

---> Package openssl-devel.x86_640:1.0.1e-48.el6_8.3 will be installed

--> Processing Dependency: zlib-develfor package: openssl-devel-1.0.1e-48.el6_8.3.x86_64

--> Processing Dependency: krb5-develfor package: openssl-devel-1.0.1e-48.el6_8.3.x86_64

---> Package pcre.x86_64 0:7.8-6.el6will be updated

---> Package pcre.x86_64 0:7.8-7.el6will be an update

---> Package pcre-devel.x86_640:7.8-7.el6 will be installed

此过程省略。。

 

查看依赖安装版本及是否成功

[root@amigo ~]# rpm -qa pcre pcre-devel openssl openssl-devel

pcre-7.8-7.el6.x86_64

openssl-devel-1.0.1e-48.el6_8.3.x86_64

openssl-1.0.1e-48.el6_8.3.x86_64

pcre-devel-7.8-7.el6.x86_64

 

创建tools文件夹存放nginx下载包

[root@amigo ~]# mkdir -p /home/oldboy/tools

 

下载nginx版本

[root@amigo tools]# wget -qhttp://nginx.org/download/nginx-1.6.3.tar.gz

[root@amigo tools]# ls

nginx-1.6.3.tar.gz 

 

创建傀儡用户

[root@amigo tools]# useradd nginx -s /sbin/nologin  -M

解压nginx安装包

[root@amigo tools]# tar xf nginx-1.6.3.tar.gz

 

进入nginx目录并执行编译

[root@amigo tools]# cd nginx-1.6.3

[root@amigo nginx-1.6.3]# ./configure --user=nginx --group=nginx--prefix=/aplication/nginx-1.6.3/ --with-http_stub_status_module--with-http_ssl_module 

 

checking for OS

 +Linux 2.6.32-504.el6.x86_64 x86_64

checking for C compiler ... found

 +using GNU C compiler

 +gcc version: 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)

checking for gcc -pipe switch ... found

checking for gcc builtin atomic operations... found

checking for C99 variadic macros ... found

checking for gcc variadic macros ... found

checking for unistd.h ... found

checking for inttypes.h ... found

checking for limits.h ... found

checking for sys/filio.h ... not found

checking for sys/param.h ... found

checking for sys/mount.h ... found

checking for sys/statvfs.h ... found

checking for crypt.h ... found

此过程省略。。

make

make install

 

创建软链接文件

[root@amigo nginx-1.6.3]# ln -s /aplication/nginx-1.6.3//aplication/nginx

 

启动并检查nginx配置文件

[root@amigo nginx-1.6.3]# /aplication/nginx/sbin/nginx -t

nginx: the configuration file/aplication/nginx-1.6.3//conf/nginx.conf syntax is ok

nginx: configuration file /aplication/nginx-1.6.3//conf/nginx.conftest is successful

 

启动nginx

[root@amigo nginx-1.6.3]# /aplication/nginx/sbin/nginx

 

查看nginx服务端口是否启动

[root@amigo nginx-1.6.3]# lsof -i :80

COMMAND  PID  USER  FD   TYPE DEVICE SIZE/OFF NODENAME

nginx   7538  root   6u  IPv4  50782     0t0  TCP *:http (LISTEN)

nginx   7539 nginx    6u IPv4  50782      0t0 TCP *:http (LISTEN)

 

浏览器输入nginx地址

Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

 


本文出自 “8655823” 博客,请务必保留此出处http://8665823.blog.51cto.com/8655823/1880160

Nginx安装过程

标签:linux

原文地址:http://8665823.blog.51cto.com/8655823/1880160

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!