简单安装和配置、Nginx、Squid反向代理功能
实验环境准备
VMWare Workstation 15:
建议高版本,低版本不支持高版本Ubuntu
操作系统:Ubuntu 18.04.1 LTS
更新Ubuntu国内更新源:(提高下载速度)
# vi /etc/apt/sources.list
// 在sources.list添加 阿里 Ubuntu 18.04.1的源
deb http://mirrors.aliyun.com/ubuntu bionic main
deb http://mirrors.aliyun.com/ubuntu bionic-security main
deb http://mirrors.aliyun.com/ubuntu bionic-updates main
Ubuntu中安装相关软件命令:
// 在线查询源中软件
# apt-cache search haproxy
// 安装
# apt-get install haproxy
提示:
可以统一使用apt命令,集合了apt-get、apt-cache、apt-config的命令;
非root用户,在所有命令前面加sudo,切换root权限;
以下大部分命令均在root权限操作;
Apache Web服务配置(用作代理)
// 本机IP地址:192.168.52.128
# apt-get install apache2 // 安装http服务
# ps -ef | grep apache2
# service apache2 stop
# service apache2 start
// 修改配置文件,配置文件分拆多个文件和目录,这里以最简单的
// /etc/apache2/apache2.conf 主配置文件
// /etc/apache2/ports.conf 端口配置
# vi /etc/apache2/ports.conf // 修改Listen为8080、8081两个端口