dr5648 2017-05-09 19:05
浏览 147
已采纳

如何使用AWS / nginx / Zend建立站点到站点的VPN

We have a Zend (1.12.20) php webapp that runs on AWS via docker containers. We also have nginx routing requests between this php webapp and other webapps.

The php webapp has a public front-end and an administrative back-end. i.e.

http://public-url.com
http://public-url.com/administrative-backend

We want to limit access to http://public-url.com/administrative-backend to only users that are on a site-to-site vpn while keeping the public frontend accessible to all of the internet.

Which layer of the stack should this be implemented in? Is AWS capable of distinguishing requests to a particular URL served by a container and making some of them require VPN authorization? Can nginx handle this somehow?

How can I limit access to a specific portion of a php webapp to vpn users while leaving the rest of the webapp publicly accessible?

  • 写回答

1条回答 默认 最新

  • dqy92287 2017-05-16 02:35
    关注

    You can use nginx to allow access to / to the public, but allow access to /administrative backend only from authorized IPs/networks like so:

    location ~ /administrative-backend {
      allow   172.31.0.0/16;
      deny    all;
    }
    

    172.31.0.0/16 could be your VPC or VPN's IP address. Please check http://nginx.org/en/docs/http/ngx_http_core_module.html#location for more details.

    If you're looking for something built into AWS, it has tools to route traffic depending on the request path (in this case /* vs /administrative-backend/*). Check out application load balancers (not the classic ELB) https://aws.amazon.com/elasticloadbalancing/applicationloadbalancer/.

    What I would do though, fore more security, is put the public and private (admin) in separate containers. Just disable all the admin stuff in the container that would serve the public.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊