首页 > 系统相关 >CentOS 7 yum 安装 Nginx

CentOS 7 yum 安装 Nginx

时间:2023-02-07 14:11:49浏览次数:41  
标签:CentOS nginx sudo Nginx yum conf

添加CentOS 7 Nginx yum资源库,打开终端,使用以下命令:

sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装Nginx

  • 在你的CentOS 7 服务器中使用yum命令从Nginx源服务器中获取来安装Nginx:
    sudo yum install -y nginx
    Nginx将完成安装在你的CentOS 7 服务器中。

启动Nginx

  • 刚安装的Nginx不会自行启动。运行Nginx:
    sudo systemctl start nginx.service
    如果一切进展顺利的话,现在你可以通过你的域名或IP来访问你的Web页面来预览一下Nginx的默认页面;如果看到这个页面,那么说明你的CentOS 7 中 web服务器已经正确安装。

CentOS 7 开机启动Nginx

  • sudo systemctl enable nginx.service
    更多systemctl命令可查看《systemctl命令用法》

Nginx配置信息

  • 网站文件存放默认目录
    /usr/share/nginx/html
  • 网站默认站点配置
    /etc/nginx/conf.d/default.conf
  • 自定义Nginx站点配置文件存放目录
    /etc/nginx/conf.d/
  • Nginx全局配置
    ``/etc/nginx/nginx.conf```
  • Nginx启动
    nginx -c nginx.conf


链接:https://www.jianshu.com/p/6874cc406f3f    

标签:CentOS,nginx,sudo,Nginx,yum,conf
From: https://www.cnblogs.com/soymilk2019/p/17098172.html

相关文章

  • arm架构服务器 centos7 更换yum源
    1.清除缓存yumcleanall2.创建备份目录mkdir/etc/yum.repos.d/bak3.备份mv/etc/yum.repos.d/*.repo/etc/yum.repos.d/bak4.在/etc/yum.repos.d/目录下创建一下三个文件......
  • nginx [error] invalid PID number in varrunnginx.pid
    执行nginx-t是正常的。当执行nginx-sreload出现以下问题因为之前的nginx执行重启的时候出现问题了,执行以下命令即可:nginx-c/etc/nginx/nginx.confnginx-s......
  • nginx 报错 upstream timed out (110: Connection timed out)
    upstreamtimedout(110:Connectiontimedout)whilereadingresponseheaderfromupstream, 在http下面加:  proxy_http_version1.1;  proxy_set_he......
  • nginx通过参数代理到其他站点
    http{includemime.types;default_typeapplication/octet-stream;resolver8.8.8.8;##Nginx0.6.18以后的版本中启用了一个resolver指令,在使用变量来构造某个server......
  • CentOS 7 安装配置git
    安装yuminstallgit-y验证[root@localhost~]#git--versiongitversion1.8.3.1[root@localhost~]#配置基本信息//配置基本信息[root@localhost~]#gi......
  • 最小化CentOS安装基础命令
    yum-yinstallwgetvimnet-toolszipunziplsoflrzszlsofbridge-utilstree\gccgcc-c++automakepcrepcre-develzlibzlib-devel\nt......
  • VMWARE安装CentOS7
                           安装完成后,把启动盘改成如下,重新启动,进入系统 ......
  • Nginx前端部署配置
    Nginx部署(针对vue项目)运行打包命令生成dist文件:npmrundev打开nginx.conf文件,配置对应的信息#nginx.conflocation/{rootC:\Users\Desktop\project\dist......
  • VirtualBox动态扩容/dev/mapper/centos-root(磁盘满了)
    一、添加硬盘(默认没有sdb块设备,即硬盘没有)1、进入设置页面,找到存储菜单,点击进去,添加控制器SATA:2、创建虚拟硬盘3、选择VHD虚拟硬盘,并点击下一步4、选择动态分......
  • centos7中关闭防火墙命令
    1、命令行界面输入命令“systemctlstatusfirewalld.service”并按下回车键。2、然后在下方可以查看得到“active(running)”,此时说明防火墙已经被打开了。3、在命令行中......