国际惯例,先上图lamp or lnmp不做过多解释。
环境检查Linux版本,是否安装Apache,是否已经安装nginx
[root@localhost notes]# cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)
[root@localhost notes]# rpm -q httpd
package httpd is not installed
[root@localhost notes]# rpm -q nginx
package nginx is not installed
###添加Nginx到YUM源,除了太长,没毛病。
[root@localhost notes]# sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
Retrieving http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
warning: /var/tmp/rpm-tmp.PxwEzV: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:nginx-release-centos-7-0.el7.ngx ################################# [100%]
安装nginx虽然已经是root 了,但还是低调的用上了sudo,过程全自动不过多解释。
这里就不wget下载,tar解压,./configure配置,make编译,make install安装了,有了yum干嘛不享受呢。
人生苦短,我用yum!!!
[root@localhost notes]# sudo yum install -y nginx
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* extras: mirror.bit.edu.cn
* updates: mirror.bit.edu.cn
nginx