linux系统为Centos 64位

一、去http://nginx.org/download/上下载相应的版本下载nginx-1.8.0.tar.gz(注:还有更高版本的)。

二、解压 tar -zxvf nginx-1.8.0.tar.gz

三、进入nginx-1.8.0/文件夹,设置一下配置信息 ./configure --prefix=/usr/local/nginx(安装后的文件存放路径)。

四、配置的时候可能会出现类似这样的信息

./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.

安装pcre-devel解决问题
yum -y install pcre-devel

安装完成后再执行./configure --prefix=/usr/local/nginx

执行完后还有可能会出现这样的问题:

checking for PCRE JIT support ... not found
checking for system md library ... not found
checking for system md5 library ... not found
checking for OpenSSL md5 crypto library ... not found
checking for sha1 in system md library ... not found
checking for OpenSSL sha1 crypto library ... not found
checking for zlib library ... found

解决办法:

yum -y install openssl openssl-devel

安装完成后再执行./configure --prefix=/usr/local/nginx

出现这个说明,配置成功了!!~

五、make && make install

出现类似这样的就表示安装成功了

cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/logs'               || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/logs' ||            mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html'               || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' ||            mkdir -p '/usr/local/nginx/logs'
make[1]: Leaving directory `/root/setup/nginx/nginx-1.8.0'

安装完后/usr/local/nginx 后出现几个文件夹conf、html、logs、sbin

启动nginx:

./usr/nginx/sbin/nginx

查看端口:

netstat -antp

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 19031/nginx
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 2771/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 906/sshd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2263/mysqld

nginx的80端口启动了。

访问安装nginx的服务器地址,出现如下图,说明成功了。

linux 安装与启动nginx的更多相关文章

  1. Linux安装ElasticSearch启动报错的解决方法

    Linux安装ElasticSearch后,ElasticSearch是不能用root用户启动的,以root用户启动会报错Refer to the log for complete error det ...

  2. linux centos-7.2-64bit 安装配置启动nginx

    1.安装依赖包yum -y install openssl openssl-develyum install pcre*yum install openssl*yum install zlib yum ...

  3. Linux 安装及配置 Nginx + ftp 服务器

    Nginx 安装及配置 一.Nginx 简介: Nginx("engine x") 是一款是由俄罗斯的程序设计师 Igor Sysoev 所开发高性能的 Web和 反向代理服务器, ...

  4. linux 安装jdk以及nginx详细过程

    一.安装jdk 1:首先下载jdk到本地,然后通过git 上传到linux服务器上 2:进入目录usr,并创建目录java,将jdk的压缩文件移动到该目录下 cd /usr mkdir java mv ...

  5. linux安装jdk tomcat nginx 以及常用命令

    linux: 操作系统,应用服务器上 常用命令: cd 切换命令 cd / cd ~ cd ../../ cd xx ll 展示所有的文件 ll -h 友好的展示 mkdir 创建目录 mkdir 目 ...

  6. linux下docker启动nginx无法访问80端口

    问题: Linux安装了docker,docker启动了一个nginx容器,通过 80 端口无法正常访问 故障排查: 1.检查 nginx 容器启动的命令或者yaml文件,查看是否有跟本机端口进行绑定 ...

  7. mac系统下安装和启动nginx

    1.在线安装 localhost:nginx-1.17.1 mhx$ sudo brew install nginx 2.查看是否安装成功 localhost:nginx-1.17.1 mhx$ ng ...

  8. Linux 普通用户启动nginx

    众所周知,apache的80端口为系统保留端口,如果通过其他非root用户启动,会报错如下: ()Permission denied: make_sock: could not bind to add ...

  9. Linux 安装、启动和卸载SSH

    卸载SSH: 先停掉SSH服务:sudo stop ssh 检查SSH是否停止:ssh localhost 检查SSH是否启动: ps -e|grep ssh 卸载SSH:apt-get --purg ...

随机推荐

  1. js便利json 数组的方法

    这篇文章主要介绍了JQuery遍历json数组的3种方法,本文分别给出了使用each.for遍历json的方法,其中for又分成两种形式,需要的朋友可以参考下 $(function () { var ...

  2. OSI七层模型详解

    OSI 七层模型通过七个层次化的结构模型使不同的系统不同的网络之间实现可靠的通讯,因此其最主要的功能就是帮助不同类型的主机实现数据传输 . 完成中继功能的节点通常称为中继系统.在OSI七层模型中,处于 ...

  3. MultipartResolver 文件上传

    SpringMVC 中文件上传 MultipartResolver 博客分类: SpringMVC - 基础篇   基于前面文章的基础上. 一.准备 需要的jar  二.配置 1.  spmvc-se ...

  4. mysql中datetime和timestamp的区别

    原文地址:http://database.51cto.com/art/200905/124240.htm 相同 显示 TIMESTAMP列的显示格式与DATETIME列相同.换句话说,显示宽度固定在1 ...

  5. 【卷二】网络三—UDP服务器与客户端

    这是另一个类型的服务器/客户端,无连接的 UDP: (User Datagram Protocol) 用户数据报协议 参考: P58~P60 UDP 时间戳服务器 [时间戳 就是ctime()显示的内 ...

  6. nginx 搭建 文件下载服务

    location / { root /home/data-nginx/; index index.html index.htm; autoindex on; ##显示索引 autoindex_exac ...

  7. ie6的png24问题

    解决IE6的PNG透明JS插件 DD_belatedPNG 引:http://www.cnblogs.com/cobby/archive/2012/05/11/2495801.html IE6的PNG ...

  8. proc中tran的一般处理

    存储过程事物的处理 一般情况在proc中判断的处理我们都采用 ) begin select '错误' return end 而在tran中我们最好用抛异常的方式 begin try begin SET ...

  9. save-dev和save的区别

    果你经常用NPM安装依赖包,会注意到安装包时的指令会分--save-dev和--save两种,有什么区别呢?   在项目中我们通常会有一个package.json的配置文件,用来保存项目的相关配置信息 ...

  10. bower工具的简单使用

    基于NodeJS的一个静态资源管理工具,由twitter公司开发维,解决大型网站中静态资源的依赖问题. 1.依赖NodeJS环境和git工具. 2.npm install -g bower安装bowe ...