当前位置:网站首页>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.
边栏推荐
- 如何用UE5渲染一个可爱的茶壶屋?
- Getting Started 11 Automatically add version numbers
- 入门文档08 条件插件
- spark算子-coalesce算子
- 硬盘分区和永久挂载
- 每日一题-下一个排列-0723
- Unity huatuo 革命性热更系列1.2 huatuo热更环境安装与示例项目
- Getting Started 05 Using cb() to indicate that the current task is complete
- The problem of redirecting to the home page when visiting a new page in dsf5.0
- UE5再次更新!扫描或手动建模面部模型可直接转为绑定好的Metahuman
猜你喜欢
随机推荐
spark source code - task submission process - 2-YarnClusterApplication
腾讯云消息队列CMQ
每日一题-无重复字符的最长子串-0712
入门文档03 区分开发与生产环境(生产环境才执行‘热更新’)
[Paper Intensive Reading] The relationship between Precision-Recall and ROC curves
spark源码-任务提交流程之-3-ApplicationMaster
入门文档08 条件插件
虚幻引擎5都有哪些重要新功能?
入门文档11 自动添加版本号
TCP/IP四层模型
每日一题-两数相加-0711
[Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data
spark源码-任务提交流程之-2-YarnClusterApplication
每日一题-三数之和-0716(2)
腾讯云云函数SCF—入门须知
入门文档05-2 使用return指示当前任务已完成
Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
专有宿主机CDH
Getting Started Doc 08 Conditional Plugins
【Day8】(超详细步骤)使用LVM扩容