centos通过yum 安装nginx和基本操作

Yum安装Nginx

1、配置Centos 7 Nginx Yum源仓库(注意系统版本要匹配,此步根据环境来确认,不是必须的)
复制代码
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
2、安装Nginx
复制代码
 yum install nginx -y
3、启动Nginx,并设置开启自启动
复制代码
systemctl start nginx
systemctl enable nginx

执行如下命令,systemctl enable nginx,如下所示的画面

4、访问Nginx

打开浏览器输入 http://服务器ip/ 可以访问到如下内容

Nginx默认地址和基本操作

默认安装地址
/etc/nginx/nginx.conf # Yum安装Nginx默认主配置文件
/usr/share/nginx/html # Nginx默认存放目录
/usr/share/nginx/html/index.html # Nginx默认主页路径

5. 基本操作

基本操作命令

1、启动Nginx

$ systemctl start nginx

2、停止Nginx

$ systemctl stop nginx

3、重载Nginx

$ systemctl reload nginx

4、重启Nginx

$ systemctl restart nginx

5、查询Nginx运行状态

$ systemctl status nginx

6、查询Nginx进程

$ ps -ef |grep nginx

7、查询Nginx监听端口

$ netstat -lntup |grep nginx

8、卸载Nginx

$ yum -y remove nginx


版权声明:本文为CSDN博主「菜鸟-要努力」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/weixin_43829047/article/details/131186899

相关推荐
椎4951 天前
苍穹外卖前端nginx错误之一解决
运维·前端·nginx
2301_787328492 天前
25.负载均衡-Nginx、HAProxy、LVS 全解析
nginx·负载均衡·lvs
siriuuus2 天前
Nginx 负载均衡调度算法
运维·nginx·负载均衡
tjsoft2 天前
设置 windows nginx.exe 每天 重启
运维·windows·nginx
舰长1152 天前
nginx 负载均衡配置
运维·nginx·负载均衡
foundbug9993 天前
查看nginx日志文件
linux·nginx·github
一只程序烽.3 天前
java项目使用宝塔面板部署服务器nginx不能反向代理找到图片资源
java·服务器·nginx
福大大架构师每日一题3 天前
nginx 1.29.2 发布:AWS-LC 支持、QUIC及SSL优化等重要更新
nginx·ssl·aws
金色天际线-3 天前
nginx + spring cloud + redis + mysql + ELFK 部署
redis·nginx·spring cloud
帅帅梓3 天前
nginx访问控制 用户认证 https
运维·nginx·https