Web服务配置.md 1.0 KB


notion-id: c4041daa-3985-4bfd-a4e0-d9c9acc1c7

apt install apache2  #安装apache2服务

systemctl status apache2         # 服务器查看
systemctl start apache2.service  #  开启服务器
systemctl stop apache2.service   # 关闭服务器

apt install mariadb-server      #安装数据库系统
/etc/init.d/mariadb start       #开启服务器【方法一】
systemctl start mariadb.service #开启服务器【方法二】

指令:mysql_secure_installation       #该脚本将删除一些不安全的默认设置并禁用对数据库系统的访问

指令:apt install php libapache2-mod-php php-mysql  

指令:apt-cache search php | egrep ‘module’ | grep default   #查看php模块

输入localhost查看是否成功,

文件地址:var\WWWW\index.html

命令改别名 : vim /root/.bashrc
新增命令: alias www='cd /var/www/html/'

输入www 即可跳转

验证php安装 新建文件index.php


<?php
$a = "hello world";
$b = $_REQUEST['msg'];
echo $b;
echo $a;
?>

浏览器输入:192.168.2.203/index.php?msg=1234