LAMP环境和软件版本
名称 | 版本号 | 查询命令 |
---|---|---|
linux系统 | CentOS Linux release 7.7.1908 (Core) | cat /etc/redhat-release |
nginx | nginx-1.16.1-1.el7.x86_64 | rpm -qa | grep nginx 或 nginx -v |
mariadb | mariadb-server-5.5.64-1.el7.x86_64 | rpm -qa | grep mariadb |
php | php-5.4.16-46.el7.x86_64 | rpm -qa | grep php |
一、安装Nginx
1、查看是否安装过nginx。
rpm -qa | grep nginx
2、有就卸载nginx。
yum remove -y "nginx*"
3、重新安装nginx。
yum install -y nginx
4、查看启动状态。
systemctl status nginx
5、启动nginx。
systemctl start nginx
6、添加开机启动。
systemctl enable nginx
7、设置防火墙开放tcp80端口。
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
firewall-cmd --query-port=80/tcp
8、使用浏览器访问http://192.168.1.150/,显示如下界面,说明安装的nginx服务正常运行。
9、默认主页index.html位于默认目录/usr/share/nginx/html中。若要发布自己的网站内容