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 小时前
docker的overlay2目录占用磁盘空间很大,清理办法
运维·docker·容器
木雷坞1 小时前
2026 年 5 月国内可用 Docker 镜像源列表与配置方法
运维·docker·容器
Irissgwe2 小时前
六、Ext系列文件系统(2.核心原理与应用)
linux·分区··inode·软硬连接·路径缓存·ext系列文件
2301_780789662 小时前
“数字珍珠港”再现:西北能源基地DNS篡改事件深度复盘与防护升级
运维·服务器·网络·tcp/ip·网络安全·智能路由器·能源
tkevinjd2 小时前
wsl2安装
linux·wsl·虚拟机·wsl2
老王谈企服2 小时前
2026制造业供应链韧性提升,智能化将成为核心解决方案吗?基于实在Agent的端到端自动化实践
运维·人工智能·ai·自动化
故事还在继续吗2 小时前
Linux 内核模块开发实战
linux·linux内核
Agent手记2 小时前
工厂货物智能入库全流程自动化:基于实在Agent与ISSUT技术的2026工业自动化实战指南
运维·人工智能·ai·自动化
南境十里·墨染春水3 小时前
linux学习进展 守护进程
linux·服务器·学习
REDcker3 小时前
Android HWASan 详解:硬件标记原理、Clang 启用与排障实践
android·linux·debug·编译·clang·asan·hwasan