## 安裝Nginx
打開nginx官方網站的下載頁`http://nginx.org/en/download.html`:
:-: 
拉倒頁面最下端,這里是預編譯包,我們選擇穩定版(stable version)nginx-1.14.0安裝,點擊進去:
:-: 
我們按照說明,創建nginx的repo文件
~~~
[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo
~~~
內容如下:
~~~
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
~~~
好了,可以安裝nginx了
~~~
[root@localhost ~]# yum install nginx -y
~~~
瞬間就安裝完了,查看一下版本:
~~~
[root@localhost ~]# nginx -v
~~~
返回:
~~~
nginx version: nginx/1.14.0
~~~
版本正確,看看nginx服務的狀態:
~~~
[root@localhost ~]# systemctl status nginx.service
~~~
返回:
~~~
● nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: http://nginx.org/en/docs/
~~~
服務沒啟動,啟動它:
~~~
[root@localhost ~]# systemctl enable nginx.service
[root@localhost ~]# systemctl start nginx.service
[root@localhost ~]# systemctl status nginx.service
~~~
返回:
~~~
● nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2018-08-15 11:40:14 CST; 9s ago
Docs: http://nginx.org/en/docs/
Process: 2095 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 2096 (nginx)
CGroup: /system.slice/nginx.service
├─2096 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
└─2097 nginx: worker process
Aug 15 11:40:14 localhost.localdomain systemd[1]: Starting nginx - high performance web server...
Aug 15 11:40:14 localhost.localdomain systemd[1]: Started nginx - high performance web server.
~~~
Nginx啟動了,小綠燈好像更亮了……
給虛擬機拍個快照保存下成果