Table of contents
1. Access status statistics configuration
2. Authorization-based access control
3. Client-based access control
4. Nginx virtual host based on domain name
5. IP-based Nginx virtual host
6. Port-based Nginx virtual host
Introduction
With virtual hosting, there is no need to provide a separate Nginx server or run a separate set of Nginx processes for each website to be run. Virtual hosting provides the function of running multiple websites on the same server and the same set of Nginx processes.
1. Access status statistics configuration
Check whether the installed Nginx contains the HTTP_STUB_STATUS module
Modify the nginx.conf configuration file, specify the access location and add stub_status configuration
Restart the service and access the test
2. Authorization-based access control
Modify configuration file
Generate user password authentication file
Restart the service and access the test
3. Client-based access control
Modify configuration file
Restart service
Allow 192.168.174.101 access
Access to 192.168.174.10 is not allowed
4. Nginx virtual host based on domain name
Provide domain name resolution for virtual hosts
Modify Nginx configuration file
Prepare web documents for virtual hosting
Restart the service and access the test
5. IP-based Nginx virtual host
Configure virtual IP address
Modify the IP address of the configuration file:
Restart the service and access the test
6. Port-based Nginx virtual host
Modify the port number in the configuration file:
Restart the service and access the test
Summary: Although there is only one server, multiple websites are running on this server. You can access different website content by accessing different domain names.