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

相关推荐
小小前端--可笑可笑4 小时前
Vue / React 单页应用刷新 /login 无法访问问题分析
运维·前端·javascript·vue.js·nginx·react.js
比奇堡派星星5 小时前
awk命令
linux·运维·服务器
WW、forever5 小时前
【服务器】上传百度网盘数据至服务器
运维·服务器
清水白石0086 小时前
Python 柯里化完全指南:从函数式思想到工程实践
linux·服务器·python
m0_694845576 小时前
netcut 是什么?简单安全的在线剪贴板搭建与使用教程
运维·服务器·安全·开源·云计算·github
宸迪6 小时前
【python】使用uv管理项目包依赖
linux·python·uv
网云工程师手记7 小时前
DDNS-Go部署与使用体验:动态公网IP远程访问不再断
运维·服务器·网络·网络协议·网络安全
HalvmånEver7 小时前
Linux:基于信号量的环形队列与生产者消费者模型(一)
linux·运维·服务器·信号量
木易 士心8 小时前
ESLint 全指南:从原理到实践,构建高质量的 JavaScript/TypeScript 代码
javascript·ubuntu·typescript
海兰8 小时前
手把手elasticsearch学习增删改查之“增”
运维·jenkins