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

相关推荐
bksczm1 分钟前
Linux之基础开发工具(Ubuntu)之apt 、vim
linux·ubuntu·php
java_logo5 分钟前
Docker 部署 Open WebUI + Ollama 完整教程(Windows / Linux 通用)—— 打造自己的本地OpenAI
linux·docker·容器·ollama·open-webui·open-webui部署·open-webui教程
程序员老邢15 分钟前
【技术底稿 23】Ollama + Docker + Ubuntu 部署踩坑实录:网络通了,参数还在调
java·经验分享·后端·ubuntu·docker·容器·milvus
小夏子_riotous15 分钟前
Docker学习路径——8、Dockerfile
linux·运维·docker·容器·系统架构·centos·运维开发
2601_9552564720 分钟前
服务器日志管理最佳实践:logrotate配置详解、云日志服务对比与Docker日志限制方案
运维·服务器·docker
切糕师学AI22 分钟前
Docker Compose 完全指南:从入门到实践
运维·docker·容器
叶子上的考拉22 分钟前
解决远程连接服务器反应较慢问题
linux·运维·服务器
JackSparrow41425 分钟前
彻底理解Java NIO(一)C语言实现 单进程+多进程+多线程 阻塞式I/O 服务器详解
java·linux·c语言·网络·后端·tcp/ip·nio
lazybird7425 分钟前
vmware装的ubuntu22.04, 在vmware中将磁盘由40G调整为50G后,ubuntu中还需要进行调整
linux·运维·服务器
Beiwen_27 分钟前
在 Linux 服务器上配置 LaTeX Workshop 并解决 `ifsym.sty` 和 `llncs.cls` 错误
linux·服务器