Saturday, April 14, 2018

Apache 反向代理 on centos

参考文章
How To Use Apache as a Reverse Proxy with mod_proxy on CentOS 7
https://www.digitalocean.com/community/tutorials/how-to-use-apache-as-a-reverse-proxy-with-mod_proxy-on-centos-7


我的sites文件
<VirtualHost *:80>
    ProxyPreserveHost On
    RewriteEngine On

    ProxyPass /api/ http://127.0.0.1:5000/api/
    ProxyPassReverse /api/ http://127.0.0.1:5000/api/
</VirtualHost>

我的flask测试文件:
@app.route('/api/welcome')
def welcome():
    return jsonify({"status":"Welcome"})


需要打开httpd链接 :setsebool -P httpd_can_network_connect on
参考 http://blog.51cto.com/babyhe/636602