一聚教程网:一个值得你收藏的教程网站

热门教程

linux/cenots中nginx的安装方法

时间:2022-06-30 18:25:05 编辑:袖梨 来源:一聚教程网

nginx 安装

yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel

cd /usr/local/src/
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --prefix=/usr/local/nginx
make && make install
nginx 目录结构

conf 配置文件
logs 日志文件
html 网页
sbin 二进制程序

启动

为了方便使用,创建一个软链接
ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx

nginx

[root@localhost sbin]# nginx -h
nginx version: nginx/1.8.0
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]# nginx -V
nginx version: nginx/1.8.0
built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)
configure arguments: --prefix=/usr/local/nginx


[root@localhost sbin]# nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful


nginx

nginx -s reload

热门栏目