nginx - 常用

启动:安装目录的执行文件+配置文件路径
执行文件目录 nginx/sbin/nginx
配合文件目录 nginx/conf/nginx.conf
[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

重启: 进入nginx可执行目录sbin下,输入命令./nginx -s reload 即可

1. 源码编译方式安装

安装make:yum -y install autoconf automake make
安装g++: yum -y install gcc gcc-c++
#一般系统中已经装了了make 和g++,无须再装
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum install -y openssl openssl-devel
#安装nginx 依赖的库
wget http://nginx.org/download/nginx-1.15.8.tar.gz
tar -zxvf nginx-1.15.8.tar.gz
cd nginx-1.15.8
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
#配置
#–prefix 指定安装目录
#–with-http_ssl_module 安装https 模块
#creating objs/Makefile 代表编译成功
make && make install
#make 编译
#make install 安装

2. yum 方式安装

yum install yum-utils
yum-config-manager --add-repo
https://openresty.org/package/centos/openresty.repo
yum install openresty

3. Nginx 目录结构

 Conf 配置文件
 Html 网页文件
 Logs 日志文件
 Sbin 二进制程序

4. Nginx 常用命令

./nginx -c nginx.conf 的文件。如果不指定,默认为NGINX_HOME/conf/nginx.conf
./nginx -s stop 停止
./nginx -s quit 退出
./nginx -s reload 重新加载nginx.conf

5. 配置安装后文件

/usr/local/nginx/conf/nginx.conf
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值