前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >centos7 nginx安装、配置

centos7 nginx安装、配置

原创
作者头像
CODER_D_XF
修改2020-12-14 15:09:33
1.2K0
修改2020-12-14 15:09:33
举报
文章被收录于专栏:XF的开发笔记XF的开发笔记

以下是实践记录整理,并不全,供参考。

yum安装

代码语言:shell
复制
# 配置 epel 源
$ sudo yum install -y epel-release
$ sudo yum -y update

# 安装及卸载
$ sudo yum -y install nginx   # 安装 nginx
$ sudo yum remove nginx  # 卸载 nginx

常用命令

代码语言:shell
复制
$ sudo systemctl enable nginx  # 设置开机启动 
$ sudo systemctl disable nginx # 取消开机启动
$ sudo systemctl start nginx   # 启动 nginx 服务
$ sudo systemctl stop nginx    # 停止 nginx 服务
$ sudo systemctl restart nginx # 重启 nginx 服务
$ sudo systemctl status nginx  # 查看 nginx 状态
$ sudo systemctl reload nginx  # 重新加载配置,一般是在修改过 nginx 配置文件时使用。
$ sudo nginx -t                # 测试 nginx 配置是否正确
$ sudo nginx -v                # 检查 nginx 版本
$ ps -ef | grep nginx # 查看服务进程

# 如果配置了防火墙,打开 80/443 端口
$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=https
$ sudo firewall-cmd --reload

nginx配置

代码语言:javascript
复制
# 默认配置文件路径
/etc/nginx/nginx.conf

# 自定义配置文件路径
-- /etc/nginx/conf.d
  -- default.conf

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • yum安装
  • 常用命令
  • nginx配置
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档