yum安装
yum install httpd
进入配置文件
vi /etc/httpd/conf/httpd.conf( /etc/httpd/conf/httpd.conf为配置文件位置)
apache默认就是使用80端口
防火墙开启80端口(一般例如在阿里云网站控制台直接开启即可)
linux常用服务的启动、停止、重启操作
服务/操作 启动 停止 重启
apache
systemctl start httpd 开启
systemctl stop httpd 停止
systemctl restart httpd 重启
nginx
systemctl start nginx 开启
systemctl stop nginx 停止
systemctl restart nginx 重启
mysql
systemctl start mysqld 开启
systemctl stop mysqld 停止
systemctl restart mysqld 重启
systemctl enable httpd.service #开机启动
systemctl disable httpd.service #开机不启动
其他类似
firewall-cmd --query-port=8080/tcp
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --remove-port=8080/tcp
firewall-cmd --reload
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、–permanent:表示设置为持久;
3、–add-port:标识添加的端口;
service firewalld start
service firewalld restart
service firewalld stop
systemctl status httpd.service
systemctl start mysqld.service #启动mysql服务
systemctl status mysqld.service #查看mysql服务状态
systemctl start httpd.service
vi /etc/httpd/conf/httpd.conf
更改监听端口
更改文件路径
更改路径下执行文件名(my.php)
配置好保存退出
systemctl start httpd.service
yum install mysql mysql-server
不多解释
yum install php php-devel
systemctl restart httpd.service
内容
重启apache 浏览器输入IP即可看见PHP页面
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
重启apache : systemctl restart httpd.service
放在新的.php文件下 更改配置文件即可在浏览器下看见测试结果