From the course: Ubuntu Linux: Service Configuration

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Restrict access to a webpage

Restrict access to a webpage

From the course: Ubuntu Linux: Service Configuration

Start my 1-month free trial

Restrict access to a webpage

- [Instructor] The web is, by its nature, open. But we can still restrict access to webpages if need be. Rather than setting up a custom user authentication system, we can use built-in tools in Apache to limit access to sites that need to be protected. Apache allows restricting access either by host or by user. So let's take a look at both. To restrict access to a site by host, we can open up the site configuration file. And add a require directive. And then put in one or more IP addresses or host names. Or a wild card pattern or a netmask. For an IP address, I put require IP. And for a host name, I put require host. And then the host name. Ranges in wild cards work here too. The require directive indicates that only requests from the given address or range of addresses will be successful in accessing the server. We can also flip that around. And instead, set addresses or ranges which are specifically disallowed, rather than specifically allowed. In order to do that, we need to use a…

Contents