美文网首页
Centos6.8安装nginx

Centos6.8安装nginx

作者: dreamZhf | 来源:发表于2016-08-11 11:18 被阅读0次

0.环境

  • 系统环境: centos 6.8
  • nginx版本: 1.11.3

1.下载指南

</pre>

2.必要软件安装指南

  • 安装pcre
    <pre>

    <code> yum -y install pcre*</code>

</pre>

  • 安装 openssl
    <pre>

    <code> yum -y install openssl*</code>

</pre>

  • 安装 gzip 类库
    <pre>

    <code> yum -y install zlib zlib-devel</code>

</pre>

3.nginx安装指南

  • 解压刚下载的nginx包
    <pre>

    <code> tar -zxvf nginx-1.11.3.tar.gz</code>

</pre>

  • 进入解压出来的文件夹中
    <pre>

    <code> cd nginx-1.11.3 </code>

</pre>

  • 使用 configure 进行配置,这里配置的都是几个常用的模块
    <pre>

    <code> ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre </code>

</pre>

  • 配置完成后,使用 make & make install 两个命令来进行编译与安装
    <pre>

    <code> make </code>

    <code> make install </code>

</pre>

  • 至此 nginx的安装已经完成,可以使用以下命令来使用nginx
    <pre>

    <code> /usr/local/nginx/sbin/nginx</code> ##启动nginx

    <code> /usr/local/nginx/sbin/nginx -s quit</code> ##停止nginx

    <code> /usr/local/nginx/sbin/nginx -s reload</code> ##重新加载配置文件

    <code> /usr/local/nginx/sbin/nginx -t </code> ##测试你的配置文件是否有误

</pre>

  • 启动好了nginx ,你现在可以打开你的浏览器并输入以下地址 http://localhost 看是否进入了你的nginx页面
  • 如有错误与疑问请尽情指出

相关文章

网友评论

      本文标题:Centos6.8安装nginx

      本文链接:https://www.haomeiwen.com/subject/ozjjsttx.html