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. TCP connect EADDRNOTAVAIL(99)错误原因分析

    转自:http://blog.chinaunix.net/uid-20662820-id-3371081.html 关于TCP connect 返回错误99,可以能大家都会遇到,这里就分析一下这个错误 ...

  2. .NET中的SqlBulkCopy类用法

    在开发过程中,经常会遇到向数据库插入大量数据的情况,那么如果是百万条数据,一条条的插入实在是太慢了,所以就有了SqlBulkCopy类. 本文中我将示范SqlBulkCopy类的不同应用. 以下面三张 ...

  3. CC版本添加 LUCI

    BB版本的时候,在 feeds/luci/contrib/package/luci下的Makefile文件添加上需要编译的 luci-application即可. 在CC版里改为:Feeds/luci ...

  4. 【XML】document.createEvent的使用方法

    <aclass="comment-mod"onclick="alert('ss')"href="#">评论</a> ...

  5. Win内存分配函数(GlobalAlloc/HeapAlloc/LocalAlloc/VirtualAlloc)

    Win内存分配函数(GlobalAlloc/HeapAlloc/LocalAlloc/VirtualAlloc) 来源:http://blog.csdn.net/chunyexiyu/article/ ...

  6. Eclipse 打开当前文件所在的文件夹

    两种方法: 1.安装EasyExplorer插件,有了这个插件就可以很方便地打开资源文件所在的文件夹了. EasyExplorer 从 http://sourceforge.net/projects/ ...

  7. Spring对jdbc支持

    4. Spring对jdbc支持 spring对jdbc提供了很好的支持 体现在: 1.Spring对C3P0连接池的支持很完善 2.Spring对jdbc提供了jdbcTemplate来简化jdbc ...

  8. Linux修改SSH端口和禁止Root远程登陆

    Linux修改ssh端口22 vi /etc/ssh/ssh_config vi /etc/ssh/sshd_config 然后修改为port 8888 以root身份service sshd res ...

  9. 表格单元格td设置宽度无效的解决办法 .

    http://zzstudy.offcn.com/archives/11366 在做table页面时,有时对td设置的宽度是无效的,td的宽度始终有内部的内容撑开,可以设置padding,但直接设置w ...

  10. 回滚 rollback

    为了保证在应用程序.数据库或系统出现错误后,数据库能够被还原,以保证数据库的完整性,所以需要进行回滚. 回滚(rollback)就是在事务提交之前将数据库数据恢复到事务修改之前数据库数据状态. 回滚执 ...