随手安装个nginx到Linux

  • 2018-03-14
  • 249
  • 4
  • 0

2018.3.15 更新提示为中文

环境:阿里云 Centos 7
Nginx 1.12.2

N年以前Windows安装IIS,今天重蹈覆辙,不过是在Linux里安装Nginx啦.

3. 下载nginx源码,将文件放到/usr/local/src/ 目录下

#cd /usr/local/src

#wget http://nginx.org/download/nginx-1.12.2.tar.gz     //下载nginx源码

#tar -zxvf nginx-1.12.2.tar.gz   //解压

#./configure

报错:

./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.
错误:HTTP重写模块需要PCRE库。
您可以通过使用--without-http_rewrite_module来禁用该模块选项,
或者将PCRE库安装到系统中,或者构建PCRE库
通过使用--with-pcre=<path>选项从nginx源静态地。

./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
错误:HTTP gzip模块需要zlib库。
您可以使用--without-http_gzip_module禁用该模块选项,或者将zlib库安装到系统中,
或者构建zlib库,通过使用--with-zlib=<path>选项从源代码静态地使用nginx。

最后我得出结果,新增三个参数:

./configure --without-http_rewrite_module --without-http_gzip_module --prefix=/usr/local/nginx
提示文章是:https://www.fujieace.com/nginx/make1-leaving-directory-usrlocalnginx.html

通过提示:

Configuration summary
  + PCRE library is not used
  + OpenSSL library is not used
  + zlib library is not used

  nginx path prefix: "/usr/local/nginx"
  nginx binary file二进制文件: "/usr/local/nginx/sbin/nginx"
  nginx modules path模块路径: "/usr/local/nginx/modules"
  nginx configuration prefix配置前缀: "/usr/local/nginx/conf"
  nginx configuration file配置文件: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file错误日志: "/usr/local/nginx/logs/error.log"
  nginx http access log file访问日志: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files客户端请求正文临时文件: "client_body_temp"
  nginx http proxy temporary files代理临时文件: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"
#make   编译nginx(生成2进制)
#make install 安装nginx(把生成的 2 进制复制到 prefix 指定的安装路径里)

#/usr/local/nginx/sbin/nginx    启动命令

#/usr/local/nginx/sbin/nginx -t 检测配置文件
#/usr/local/nginx/sbin/nginx -s  reload 平滑重启(修改配置文件后,可使用此命令重启,不影响运行)
#/usr/local/nginx/sbin/nginx -s quit 结束nginx(待nginx进程执行任务完毕后退出)
#/usr/local/nginx/sbin/nginx -s stop 直接退出nignx

启动nginx,访问http://ip ,界面如下,nginx安装成功。

  1. 2017:  又是噩梦一个 敖厂长(0)
  2. 2017:  遇到这些,人与人之间的信任瞬间被摧毁(0)

评论

    • Waylee回复
      Google Chrome 64 Google Chrome 64 Windows 10 Windows 10

      哈哈,猴年马月我就是高手了

  • 银色月航回复
    Google Chrome 65 Google Chrome 65 Mac OS X 10.10 Mac OS X 10.10

    干货,一直没搞过。。。
    就羡慕nugix大神

    • Waylee回复
      Google Chrome 64 Google Chrome 64 Windows 10 Windows 10

      你英文都打错了,哈哈

发表评论