Complete the code to specify the server name for a virtual host.
server {
listen 80;
server_name [1];
root /var/www/example;
}The server_name directive tells Nginx which domain this server block will respond to. Using example.com sets the virtual host for that domain.
Complete the code to listen on port 80 for HTTP requests.
server {
[1] 80;
server_name example.com;
root /var/www/example;
}The listen directive tells Nginx which port to listen on for incoming requests. Port 80 is the default for HTTP.
Fix the error in the server block to serve multiple domains.
server {
listen 80;
server_name example.com [1];
root /var/www/example;
}To serve multiple domains in one server block, list them all in the server_name directive separated by spaces.
Fill both blanks to configure two server blocks for different domains.
server {
listen 80;
server_name [1];
root /var/www/site1;
}
server {
listen 80;
server_name [2];
root /var/www/site2;
}Each server block should have its own domain in server_name to serve different sites.
Fill all three blanks to complete the virtual host configuration for multiple domains with different roots.
server {
listen [1];
server_name [2];
root [3];
}Listen on port 80 for HTTP, set the server_name to the domain, and root to the folder with site files.