centos7安装nginx(yum方式)

1.添加yum源

默认情况Centos7中无Nginx的源,可以如下执行命令添加源:
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.安装Nginx

通过yum search nginx看看是否已经添加源成功。如果成功则执行下列命令安装Nginx。
yum install  nginx

3.启动Nginx并设置开机自动运行

systemctl start  nginx.service
systemctl enable nginx.service

4.查看nginx的yum(rpm)包默认的解压安装路径

   [root@localhost ~]# rpm -ql nginx 
    /etc/logrotate.d/nginx
    /etc/nginx
    /etc/nginx/conf.d
    /etc/nginx/conf.d/default.conf
    /etc/nginx/fastcgi_params
    /etc/nginx/koi-utf
    /etc/nginx/koi-win
    /etc/nginx/mime.types
    /etc/nginx/modules
    /etc/nginx/nginx.conf
    /etc/nginx/scgi_params
    /etc/nginx/uwsgi_params
    /etc/nginx/win-utf
    /etc/sysconfig/nginx
    /etc/sysconfig/nginx-debug
    /usr/lib/systemd/system/nginx-debug.service
    /usr/lib/systemd/system/nginx.service
    /usr/lib64/nginx
    /usr/lib64/nginx/modules
    /usr/libexec/initscripts/legacy-actions/nginx
    /usr/libexec/initscripts/legacy-actions/nginx/check-reload
    /usr/libexec/initscripts/legacy-actions/nginx/upgrade
    /usr/sbin/nginx
    /usr/sbin/nginx-debug
    /usr/share/doc/nginx-1.16.0
    /usr/share/doc/nginx-1.16.0/COPYRIGHT
    /usr/share/man/man8/nginx.8.gz
    /usr/share/nginx
    /usr/share/nginx/html
    /usr/share/nginx/html/50x.html
    /usr/share/nginx/html/index.html
    /var/cache/nginx
    /var/log/nginx

配置文件  /etc/nginx/nginx.conf  、/etc/nginx/conf.d/default.conf

web应用目录 /usr/share/nginx  (html目录,下有index.html,50x.html)

文档doc目录  /var/share/doc 

应用日志目录  /var/log/nginx   (access.log、error.log)
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Redhat 使用CentOSyum源进行升级或软件安装 分类: linux 2012-07-19 15:54 1113人阅读 评论(0) 收藏 举报 Redhat默认的源不但速度不给力,而且软件版本陈旧,今天试着将Redhat默认源替换为CentOS的163源,发现速度能达到2M/s左右,而且版本都比较新,非常给力,与大家分享! (目前可以使用CentOS0-6.3软件仓库的软件) 1. 删除原有的yum源 1. # rpm -aq | grep yum|xargs rpm -e --nodeps 2.下载新的yum安装包,这里使用centos-6.3 1. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm 2. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 3. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-3.2.29-30.el6.centos.noarch.rpm 4. # wget http://mirror.centos.org/centos/6.3/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm 3.安装yum软件包 1. #rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 2. # rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 3. #rpm -ivh yum-3.2.29-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm 4. 更改yum源 在/etc/yum.repos.d/新建文件centos.repo,内容如下: ######################################################################### # CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-6 - Base - 163.com baseurl=http://mirrors.163.com/centos/6/os/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6 - Updates - 163.com baseurl=http://mirrors.163.com/centos/6/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-6 - Extras - 163.com baseurl=http://mirrors.163.com/centos/6/extras/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-6 - Plus - 163.com baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-6 - Contrib - 163.com baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 5.清理yum缓存 1. # yum clean all 2. # yum makecache #将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度 3. # yum install software_name #测试新源是否可用 6.更新系统 #yum update -y # yum install nginx chkconfig --level 345 nginx on /etc/init.d/nginx start yum --enablerepo=remi install php php-fpm chkconfig --level 345 php-fpm on /etc/init.d/php-fpm restart vi /etc/nginx/nginx.conf /etc/init.d/nginx reload vi /usr/share/nginx/html/info.php 1.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值