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.

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

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改