大网数据广告活动
网站运营与故障问答

How to restrict web site/intranet access to company network?

· 52CE 我爱测

What is the best/most secure way to create a web site or intranet on an externally hosted server, but make it only accessible from within my company's network? I am trying to avoid running my own server internally.

问题原文

原帖链接 · Jason · CC BY-SA 3.0

What is the best/most secure way to create a web site or intranet on an externally hosted server, but make it only accessible from within my company's network? I am trying to avoid running my own server internally.

社区高分解答

原帖链接 · Andrew Lott · CC BY-SA 3.0

Step 1: Require a Login

Add a login page in front of any content you don't want accessed externally. This will also help stop anybody visiting your office and using your WiFi from getting in. This is also a good idea even if you do host internally.

Step 2: Add an SSL

Add an SSL certificate so that you can load the site over HTTPS. This will stop any snoopers between your office and the webserver from reading what's going on.

Step 3: Block External Visitors

Use your .htaccess or nginx config to block IP addresses outside your company network. Anybody working remotely who still needs access should be able to do so via VPN.

Apache:

Order Deny,Allow
Deny from all
Allow from 1.2.3.4

nginx:

location / {
  allow 1.2.3.4;
  deny all;
}

Step 4: Set Noindex

Just in case any crawlers still manage to get past the IP block (which is easy enough to mess up or lose after a config update), tell them not to index your site.

Add <meta name="robots" content="noindex" /> into the HEAD of your pages, and return a X-Robots-Tag "noindex, nofollow" header.

nginx:

add_header  X-Robots-Tag "noindex, nofollow";

PHP:

header("X-Robots-Tag: noindex", true);

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2018-02-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。