ubuntu apache2配置反向代理

1.Ubuntu安装apache

复制代码
sudo apt-get update
sudo apt-get install apache2

2.apache2反向代理配置

复制代码
sudo vim /etc/apache2/sites-available/000-default.conf 

添加内容如下:

复制代码
<VirtualHost *:80>
	# The ServerName directive sets the request scheme, hostname and port that
	# the server uses to identify itself. This is used when creating
	# redirection URLs. In the context of virtual hosts, the ServerName
	# specifies what hostname must appear in the request's Host: header to
	# match this virtual host. For the default virtual host (this file) this
	# value is not decisive as it is used as a last resort host regardless.
	# However, you must set it for any further virtual host explicitly.
	#ServerName www.example.com

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html

	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
	# error, crit, alert, emerg.
	# It is also possible to configure the loglevel for particular
	# modules, e.g.
	#LogLevel info ssl:warn

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	# For most configuration files from conf-available/, which are
	# enabled or disabled at a global level, it is possible to
	# include a line for only one particular virtual host. For example the
	# following line enables the CGI configuration for this host only
	# after it has been globally disabled with "a2disconf".
	#Include conf-available/serve-cgi-bin.conf

 	ProxyPreserveHost On
    ProxyPass / http://localhost:8888/
    ProxyPassReverse / http://localhost:8888/
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

3.web页面访问 输入localhost:8888弹出自己设计的界面

4.与web网页进行通讯则可以参考下面的连接

ubuntu http 服务器响应-CSDN博客

相关推荐
吴建旭 智宅焕1 小时前
智能家居全国交付中执行端能力评估与分级调度架构设计:从注册数量到交付确定性的系统实现
运维·智能家居·devops
嵌入式 Linux手记2 小时前
一块内存,三种解释:union 的真实用法
linux·c语言·驱动开发·嵌入式
星恒随风2 小时前
MySQL 从零入门(九):事务管理详解——ACID、COMMIT、ROLLBACK、SAVEPOINT 与四种隔离级别
linux·服务器·数据库·笔记·mysql
草莓熊Lotso2 小时前
【C++ 基于微服务的即时通讯系统】ElasticSearch 用户数据管理实现
linux·数据库·c++·elasticsearch·微服务·架构
IT大白鼠3 小时前
eBPF 观测入门:用 bpftrace 给服务器装上“内核摄像头“
运维·服务器·ebpf
星恒随风3 小时前
MySQL 从零入门(十一):视图与用户权限管理详解
linux·服务器·数据库·笔记·mysql
分布式存储与RustFS3 小时前
Zeppelin 笔记本重启就丢:三个环境变量把 .zpln 存进 RustFS 桶
运维·云原生·开源·对象存储·分布式存储·s3·性能基准
好用斋4 小时前
内网测速 LibreSpeed:网页版 Docker 测速服务
运维·docker·容器
江华森5 小时前
从零开始:智能运维概念与Linux环境准备完全指南
linux·运维
努力写代码的熊大6 小时前
Linux 个人复盘博客 · 第六篇 Linux 进程间五种通信:匿名管道、命名管道、共享内存、消息队列与信号量
linux·经验分享·笔记