建设中。。。
学习>>
LEARNING
工作>>
WORKING
生活>>
lIVING

Ubuntu 搭建Web服务器(MySQL+PHP+Apache)

一.安装mysql

1.打开 Ubuntu 终端,使用下面速度命令进入管理员权限
sudo su

2.安装
apt-get install mysql-server
apt-get install mysql-client
apt-get install libmysqlclient-dev

3.安装 net-tools
apt install net-tools

4.检查是否安装成功
sudo netstat -tap | grep mysql

5.登陆mysql
mysql -u root -p

二.安装 Apache2

1.安装
apt-get install apache2
输入 Y 同意

2.检查是否安装成功,在浏览器输入地址:
http:localhost

3.apache 的默认的一些目录
默认文档根目录是在 ubuntu 上的 /var/www 目录
配置文件是 / etc/apache2/apache2.conf
配置存储在的子目录在/etc/apache2 目录

4.手动开启/关闭 Apache 服务器
(1)重启 Apache 服务器(常用) sudo /etc/init.d/apache2 restart (2)开启 Apache 服务器 sudo /etc/init.d/apache2 start (3)关闭 Apache 服务器 sudo /etc/init.d/apache2 stop

三.安装安装 php 7.0

1.使用命令
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php && sudo apt-get update
sudo apt-get -y install php7.2
# 如果之前有其他版本PHP,在这边禁用掉
sudo a2dismod php5
sudo a2enmod php7.2
# 安装常用扩展(建议安装)
sudo apt-get -y install php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml php7.2-intl php7.2-odbc php7.2-cgi
# 安装其他扩展(按需要安装)
sudo apt-get install php7.2-gd
sudo apt-get install php7.2-soap
sudo apt-get install php7.2-gmp
sudo apt-get install php7.2-pspell
sudo apt-get install php7.2-bcmath
sudo apt-get install php7.2-enchant
sudo apt-get install php7.2-imap
sudo apt-get install php7.2-ldap
sudo apt-get install php7.2-opcache
sudo apt-get install php7.2-readline
sudo apt-get install php7.2-sqlite3
sudo apt-get install php7.2-xmlrpc
sudo apt-get install php7.2-bz2
sudo apt-get install php7.2-interbase
sudo apt-get install php7.2-pgsql
sudo apt-get install php7.2-recode
sudo apt-get install php7.2-sybase
sudo apt-get install php7.2-xsl
sudo apt-get install php7.2-dba
sudo apt-get install php7.2-phpdbg
sudo apt-get install php7.2-snmp
sudo apt-get install php7.2-tidy
sudo apt-get install php7.2-zip

沪ICP备18011338号