脚本宝典收集整理的这篇文章主要介绍了Ubuntu20.04搭建web服务器,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
并且可用phpMyAdmin来管理数据库
sudo apt-get install apache2
一路确定,安装完成后在服务端浏览器输入localhost
,或者在本地浏览器输入服务器等ip,即可看到apache默认的welcome网页
在 /VAR/www下有一个htML目录,进去后有一个index.html文件,其实就是我们输入localhost显示的页面
vim /var/www/html/index.html
我们在/var/www下自己新建一个目录,这里面放一个自己写的html文件
vim /etc/apache2/sITes-available/000-default.conf
更改DocumentRoot处代码即可,后跟储存html的文件夹
vim /etc/apache2/mods-enabled/dir.conf
更改DirecrtoryIndex处代码即可,后跟html文件名
修改完毕后执行
sudo /etc/init.d/apache2 restart
重启apache服务后刷新浏览器页面即可
关于安装此版本的原因以及过程在之前的文章已写过,直接放过来:
MySQL8降级安装MySQL5.7
libapache2-mod-php7.0是为了让apache2支持php模块
安装比较多也是少了后续的一些麻烦
sudo apt-get install Software-PRoperties-common
sudo add-apt-repository ppa:ondrej/php && sudo apt-get update
sudo apt-get install php7.0 libapache2-mod-php7.0
# 如果之前有其他版本PHP,在这边禁用掉
sudo a2dismod php5
sudo a2enmod php7.0
# 安装常用扩展(建议安装)
sudo apt-get -y install php7.0-FPM php7.0-mysql php7.0-curl php7.0-JSON php7.0-mbstring php7.0-XMl php7.0-intl php7.0-odbc php7.0-cgi
# 安装其他扩展(按需要安装)
sudo apt-get install php7.0-gd
sudo apt-get install php7.0-SOAp
sudo apt-get install php7.0-gmp
sudo apt-get install php7.0-pspell
sudo apt-get install php7.0-bcmath
sudo apt-get install php7.0-enchant
sudo apt-get install php7.0-imap
sudo apt-get install php7.0-ldap
sudo apt-get install php7.0-Opcache
sudo apt-get install php7.0-readline
sudo apt-get install php7.0-sqlite3
sudo apt-get install php7.0-xmlrpc
sudo apt-get install php7.0-bz2
sudo apt-get install php7.0-interbase
sudo apt-get install php7.0-pgsql
sudo apt-get install php7.0-recode
sudo apt-get install php7.0-sybase
sudo apt-get install php7.0-xsl
sudo apt-get install php7.0-dba
sudo apt-get install php7.0-phpdbg
sudo apt-get install php7.0-snmp
sudo apt-get install php7.0-tidy
sudo apt-get install php7.0-zip
首先查找相应的需要安装的包:
sudo apt-cache seArch php7.0
若mysql已经开启密码服务则需要先将其关闭,安装好phpmyadmin后再打开
sudo apt-get install phpmyadmin
安装详解
使用教程
原帖:this
以上是脚本宝典为你收集整理的Ubuntu20.04搭建web服务器全部内容,希望文章能够帮你解决Ubuntu20.04搭建web服务器所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。