码迷,mamicode.com
首页 > 系统相关 > 详细

linux下安装nginx

时间:2018-07-04 13:39:17      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:show   sign   figure   https   bsp   信号   离线安装   安装完成   and   

一篇很全的帖子:http://www.nginx.cn/install

安装nginx之前,要先在服务器上安装nginx运行所需要的依赖包

目录选择:一般选择 "/usr/local/"

1.安装PCRE库

离线安装包:https://pan.baidu.com/s/1k_jDkGuMD5XRqDBz5MYhLg 密码:89nj

也可以使用wget在线下载安装包

1 cd /usr/local/
2 wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz 
3 tar -zxvf pcre-8.37.tar.gz
4 cd pcre-8.34
5 ./configure
6 make
7 make install

2.安装zlib库

离线安装包:https://pan.baidu.com/s/1198lSj48reV9vvjZjKJpHQ 密码:4nrl

也可以使用wget在线下载安装包

1 wget http://zlib.net/zlib-1.2.11.tar.gz
2 tar -zxvf zlib-1.2.11.tar.gz
3 cd zlib-1.2.11
4 ./configure
5 make
6 make install

3.安装openssl(如果之前已经安装,就不用重新装了)

离线安装包:https://pan.baidu.com/s/1V57vak0Z38fxPe3-JOTsSA 密码:8aig

也可以使用wget在线下载安装包

1 wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz
2 tar -zxvf openssl-1.0.1t.tar.gz

上述依赖包安装完成后,继续安装nginx

离线安装包:https://pan.baidu.com/s/1AuV0q5qnX7lKoMggOFS5gg 密码:oytn

也可以使用wget在线下载安装包

1 wget http://nginx.org/download/nginx-1.1.10.tar.gz
2 tar -zxvf nginx-1.1.10.tar.gz
3 cd nginx-1.1.10
4 ./configure
5 make
6 make install

 安装完成后会在 /usr/local/ 下多出一个nginx目录(注意:nginx-1.9.1这个目录解压后的安装包,是个程序包目录,而安装完成nginx后会出现一个nginx目录)

技术分享图片


1.未启动nginx时,进入nginx目录,如下图所示

技术分享图片

2.启动后,nginx目录下会多出几个文件夹,如下图所示

技术分享图片


nginx常用命令

1.启动命令

第一种方式:[root@localhost ~]# /usr/local/nginx/sbin/nginx

第二种方式:[root@localhost ~]# cd /usr/local/nginx/sbin  # 先切换到/sbin目录
          [root@localhost sbin]# ./nginx

(其实是一样的)

2.停止命令

第一种方式:[root@localhost sbin]# ./nginx -s stop   # 先切换到/sbin目录,然后使用该命令

第二种方式:[root@localhost sbin]# ./nginx -s quit # -s都是采用向 Nginx 发送信号的方式。

 3.修改nginx配置后,重新加载配置文件

第一种方式:[root@localhost sbin]# ./nginx -s reload
第二种方式:[root@localhost sbin]# /usr/local/nginx/sbin/nginx -s reload

4.显示帮助信息

[root@localhost sbin]# ./nginx -h
nginx version: nginx/1.9.1
Usage: nginx [-?hvVtq] [-s signal] [-c filename] [-p prefix] [-g directives]

Options:
  -?,-h         : this help
  -v            : show version and exit
  -V            : show version and configure options then exit
  -t            : test configuration and exit
  -q            : suppress non-error messages during configuration testing
  -s signal     : send signal to a master process: stop, quit, reopen, reload
  -p prefix     : set prefix path (default: /usr/local/nginx/)
  -c filename   : set configuration file (default: conf/nginx.conf)
  -g directives : set global directives out of configuration file

[root@localhost sbin]#

 

linux下安装nginx

标签:show   sign   figure   https   bsp   信号   离线安装   安装完成   and   

原文地址:https://www.cnblogs.com/hanmk/p/9258149.html

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