当前位置:网站首页>Apache configure reverse proxy
Apache configure reverse proxy
2022-08-05 06:11:00 【MuggleTan】
In order to allow your spring boot project to be directly accessed by the domain name instead of the IP: port number, you need to use a reverse proxy.Access with domain name.Many tutorials on the Internet are for nignx, and I use apache, and I don’t want to change apache to nignx.
1. Enable Apache's proxy module
After making sure Apache is installed, enable Apache's proxy module via a2enmod proxy proxy_balancer proxy_http.
I am using Ubuntu's Apache and the Apache directory structure under centos seems to be a bit different.
2. Modify the configuration file
Switch to the /etc/apache2/sites-enabled directory and open the configuration corresponding to the website that needs to be modified

If not, create a new configuration file. The name of the file is the prefix .conf of the second-level domain name. For example, my domain name is steventan.top.
Then the website corresponding to test.conf is test.steventan.top, which seems to be just a naming habit, and it is not a big problem if it is different. This is mainly for the convenience of management.
ServerName autoclock.steventan.top #Fill in the IP or domain name of the proxy server hereProxyRequests off #off means turn on reverse proxy on means turn on forward proxyProxyPass / http://localhost:8080/ #The proxy website, the one in the middle / must not be missing, if there is less, restart and report an errorProxyPassReverse / http://localhost:8080/ #ProxyPassReverse# RewriteEngine on# RewriteCond %{HTTPS} !=on# RewriteRule ^(.*) https://%{SERVER_NAME}$1 [L,R]ErrorLog ${APACHE_LOG_DIR}/error.logCustomLog ${APACHE_LOG_DIR}/access.log combined The above configuration is to map the program running on the local port 8080 to the domain name autoclock.steventan.top, which achieves my purpose. The spring boot project running on the server can be accessed directly on the public network through the domain name.
3. Restart apache to take effect configuration
Restart Apache via service apache2 restart to make the configuration file take effect.
边栏推荐
猜你喜欢

Autoware中安装Yolo3目标检测模块遇到的问题

账号与权限管理

阿里云视频点播

dsf5.0 弹框点确定没有返回值的问题

Unity中的GetEnumerator 方法及MoveNext、Reset方法

The problem of redirecting to the home page when visiting a new page in dsf5.0

如何用UE5渲染一个可爱的茶壶屋?

2020,Laya最新中高级面试灵魂32问,你都知道吗?

Getting Started 04 When a task depends on another task, it needs to be executed in sequence

论那些给得出高薪的游戏公司底气到底在哪里?
随机推荐
交换机原理
The problem of calling ds18b20 through a single bus
Account and Permission Management
错误类型:reflection.ReflectionException: Could not set property ‘xxx‘ of ‘class ‘xxx‘ with value ‘xxx‘
[Day5] Soft and hard links File storage, deletion, directory management commands
Getting Started 04 When a task depends on another task, it needs to be executed in sequence
【Day1】(超详细步骤)构建软RAID磁盘阵列
I/O性能与可靠性
云计算——osi七层与TCP\IP协议
入门文档09 独立的watch
【Day8】Knowledge about disk and disk partition
NIO工作方式浅析
Getting Started Doc 06 Adding files to a stream
Contextual non-local alignment of full-scale representations
不吹不黑,这的确是我看过微服务架构最好的文章!
VLAN details and experiments
Getting Started Documentation 10 Resource Mapping
spark源码-任务提交流程之-2-YarnClusterApplication
图片压缩失效问题
你要找的cocos面试答案都在这里了!