linux安装nginx(两种方式)

第一:yum 方式安装

  1:参考http://nginx.org/en/linux_packages.html#stable    

  2:根据自己的系统类型进行更改

  Pre-Built Packages for Stable version
  To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with the following contents:

  [nginx]
  name=nginx repo
  baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
  gpgcheck=0
  enabled=1


  Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “6” or “7”, for 6.x or 7.x versions, respectively.

  3:    查看 yum list | grep  nginx

    安装  yum install  nginx

  4: nginx -v 查看版本

     查看安装路径

   rpm -ql nginx

   得到安装路径后

  5:最后启动nginx /usr/sbin/nginx

  6:重启服务可以 使用

  systemctl restart nginx   或者  systemctl reload nginx

以上就结束安装了,

如有错误,请邮件zs253499660@sina.com,如有更好的方法,可以推荐
原文地址:https://www.cnblogs.com/senjiang/p/9686965.html