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博客

相关推荐
剑客的茶馆6 小时前
开发者,运维怎样转行FDE?
运维·ai·开发·fde
Julien20046 小时前
控制 SELinux 文件上下文
linux·运维·服务器
sulikey7 小时前
Linux Core Dump 完全指南:从原理到实战的崩溃调试手册。什么是core dump?程序报错core dumped怎么办?
linux·服务器·操作系统·调试·coredump
众壹新能源科技7 小时前
功率预测误差考核怎么降?从气象源到上报口径的排查清单
运维·人工智能·自动化
DevLoom_8 小时前
SD卡插电脑提示:驱动器中的磁盘未被格式化?恢复数据正确处理步骤
运维·服务器·电脑
Orange_sparkle8 小时前
从 Docker 到 Doris:建立后端基础设施全景图
运维·docker·ai·容器·claude code
2601_962128269 小时前
Nginx目录结构
运维·nginx
MayZork9 小时前
Windows 与 Linux 下 vcpkg 的安装部署指南
linux·运维·windows
yyuuuzz9 小时前
记一次 VPS 性能排查:共享 CPU 突发额度导致的限流
运维·服务器·人工智能
冰雪青松10 小时前
Ubuntu 运维命令大全:从入门到精通的实战参考手册
运维·服务器·ubuntu