当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
偷题——腾讯游戏开发面试问题及解答
通过单总线调用ds18b20的问题
[Day1] VMware software installation
Getting Started Document 01 series in order
spark源码-任务提交流程之-5-CoarseGrainedExecutorBackend
D46_给刚体施加的力
spark源码-任务提交流程之-7-流程梳理总结
你要找的cocos面试答案都在这里了!
Getting Started Document 09 Standalone watch
The problem of calling ds18b20 through a single bus
Getting Started Documentation 10 Resource Mapping
Spark源码-任务提交流程之-6.2-sparkContext初始化-TaskScheduler任务调度器
云游戏未来展望
每日一题-正则表达式匹配-0715
腾讯内部技术:《轩辕传奇》服务器架构演变
来来来,一文让你读懂Cocos Creator如何读写JSON文件
Unity3D中的ref、out、Params三种参数的使用
每日一题-无重复字符的最长子串-0712
UE5再次更新!扫描或手动建模面部模型可直接转为绑定好的Metahuman
Unity物理引擎中的碰撞、角色控制器、Cloth组件(布料)、关节 Joint








