ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
1、配置epel源 [root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo --2017-12-01 17:08:56-- http://mirrors.aliyun.com/repo/epel-7.repo Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 180.163.159.88, 180.163.159.87, 180.163.159.84, ... Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|180.163.159.88|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1084 (1.1K) [application/octet-stream] Saving to: ‘/etc/yum.repos.d/epel-7.repo’ 100%[=====================================================================================================================>] 1,084 --.-K/s in 0s 2017-12-01 17:09:07 (111 MB/s) - ‘/etc/yum.repos.d/epel-7.repo’ saved [1084/1084] [root@localhost yum.repos.d]# ll epel-7.repo -rw-r--r--. 1 root root 1084 Nov 21 2014 epel-7.repo 2、查看nginx版本 [root@localhost ~]# yum info nginx ![](https://box.kancloud.cn/e6e34752d91f390d527255402ae3be99_733x350.png) 3、安装nginx [root@localhost ~]# yum -y install nginx 4、nginx目录结构 配置文件: /etc/nginx 启动脚本:/usr/lib/systemd/system/nginx.service 脚本配置文件:/etc/sysconfig/nginx nginx命令:/usr/sbin/nginx 模块文件:/usr/lib64/nginx/modules 说明文档目录:/usr/share/doc/ 日志切割:etc/logrotate.d/nginx 日志文件:/var/log/nginx 默认主目录:/usr/share/nginx/html/ 5、启动nginx服务 [root@localhost ~]# systemctl start nginx [root@localhost ~]# systemctl status nginx ● nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Fri 2017-12-01 17:22:30 CST; 4s ago Process: 2425 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS) Process: 2423 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS) Process: 2421 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) Main PID: 2428 (nginx) CGroup: /system.slice/nginx.service ├─2428 nginx: master process /usr/sbin/nginx └─2429 nginx: worker process 通过配置nginx repo仓库也可以 1、配置nginx repo仓库 [root@static ~]# vim /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enabled=1 注意: baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/ 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. 2、然后安装nginx [root@localhost ~]# yum -y install nginx