It is very common when programming to establish a developer website and a separate production website.
To limit the developer website to just the programmers ip address both Apache2 and Nginx do this very easily.
Nginx, is great for providing https as in secure connections over http. Based on the directory requested of a website, nginx will forward the connection to Apache2 where Nginx and or Apache2 may continue to service the information from the data http request, depending on how this is setup in the config files of both servers.
Nginx can allow or limit connections from the location
Nginx /var/nginx/sites-enabled/default
server {
server_name example.com www.example.com;
root /var/html/www;
location ~ / {
allow 192.168.1.2;
allow 192.168.1.3;
allow 192.168.1.4;
allow 192.168.1.5;
deny all;
proxy_pass http://127.0.0.1:8800;
}
}
The allow statement will allow only the ip addresses listed because the deny all resticts other ip address from connecting.
And you may want to set the permissions in Apache2 also.
Apache2 /var/apache2/sites-enabled/000-default.conf
VirtualHost *:8800 {
ServerName www.example.com
ServerAlias example.com *.example.com;
DocumentRoot /var/html/www/TheExampleWebsite;
DirectoryIndex index.py
<Directory "/var/html/www/TheExampleWebsite">
Require All granted
Allow from 192.168.1.2;
Allow from 192.168.1.3;
Allow from 192.168.1.4;
Allow from 192.168.1.5;
Deny from all;
</Directory>
}
The Allow from statement will allow only the ip addresses listed because the Deny from restricts other ip address from connecting.
This will allow to program a nice development website in a secure way to create the programming for the production server.
Happy Coding!