以下是CentOS LAMP网络配置步骤:
配置网络接口
vi /etc/sysconfig/network-scripts/ifcfg-<接口名>(如ifcfg-eth0)。BOOTPROTO=static IPADDR=192.168.1.100 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=8.8.8.8 ONBOOT=yes systemctl restart network。ip addr show或ping www.baidu.com。配置防火墙
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https firewall-cmd --reload ```。 安装LAMP组件
yum install httpd,启动并设置开机自启:systemctl start httpd && systemctl enable httpd。yum install mariadb-server,运行安全脚本:mysql_secure_installation。yum install php php-mysql,重启Apache:systemctl restart httpd。验证配置
echo "<?php phpinfo(); ?>" > /var/www/html/info.php。http://服务器IP/info.php,查看PHP信息页面。可选步骤:
setsebool -P httpd_can_network_connect 1。mod_deflate)、缓存(mod_cache)等。参考来源:[1,2,3,4,5,6,7,8,9,10]