Edehuag

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

Nginx安装及常用命令

安装步骤(建议安装在opt目录下)

#1、安装make(linux中对源代码进行编译的工具)
yum -y install autoconf automake make
#2、安装gcc(用于编译nginx源代码)
yum -y install gcc gcc-c++
#安装ngxin依赖
yum -y install wget pcre pcre-devel zlib zlib-devel openssl openssl-devel
#下载nginx源码
wget http://nginx.org/download/nginx-1.23.0.tar.gz
#解压源码
tar -zxvf nginx-1.23.0.tar.gz
#编译安装
cd nginx-1.23.0 && ./configure  --prefix=/opt/nginx && make && make install
#添加环境变量
vi /etc/profile
增加以下内容:opt/nginx 为nginx的安装目录
export PATH=$PATH:/opt/nginx/sbin
#生效环境变量
source /etc/profile
#关闭防火墙
systemctl stop firewalld
#禁止防火墙系统系统
systemctl disable firewalld

Nginx常用命令

#启动Nginx
nginx或者nginx-cnginx.conf#指定配置文件,默认为NGINX HOME/conf/nginx.conf
#停止Nginx(暴力停止)
nginx -s stop
#停止Nginx(优雅的停止)
nginx -s quit
#配置文件操作
nginx -s reload #重新加载配置。配置文件是否正确可通过:nginx-t进行校验

posted on   饿得慌~  阅读(8)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示