How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04 | DigitalOcean (2023)

Introduction

When using the Nginx web server, server blocks (similar to virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain on a single server.

In this guide, we’ll discuss how to configure server blocks in Nginx on an Ubuntu 16.04 server.

Prerequisites

We’re going to be using a non-root user with sudo privileges throughout this tutorial. If you do not have a user like this configured, you can create one by following our Ubuntu 16.04 initial server setup guide.

You will also need to have Nginx installed on your server. The following guides cover this procedure:

  • How To Install Nginx on Ubuntu 16.04: Use this guide to set up Nginx on its own.
  • How To Install Linux, Nginx, MySQL, PHP (LEMP stack) in Ubuntu 16.04: Use this guide if you will be using Nginx in conjunction with MySQL and PHP.

When you have fulfilled these requirements, you can continue on with this guide.

Example Configuration

For demonstration purposes, we’re going to set up two domains with our Nginx server. The domain names we’ll use in this guide are example.com and test.com.

Note: for more information on setting up a domain with DigitalOcean, please see our Domains and DNS product documentation.

If you do not have two spare domain names to play with, use placeholder names for now and we’ll show you later how to configure your local computer to test your configuration.

Step 1 — Setting Up New Document Root Directories

By default, Nginx on Ubuntu 16.04 has one server block enabled. It is configured to serve documents out of a directory at /var/www/html.

While this works well for a single site, we need additional directories if we’re going to serve multiple sites. We can consider the /var/www/html directory the default directory that will be served if the client request doesn’t match any of our other sites.

We will create a directory structure within /var/www for each of our sites. The actual web content will be placed in an html directory within these site-specific directories. This gives us some additional flexibility to create other directories associated with our sites as siblings to the html directory if necessary.

We need to create these directories for each of our sites. The -p flag tells mkdir to create any necessary parent directories along the way:

  1. sudo mkdir -p /var/www/example.com/html
  2. sudo mkdir -p /var/www/test.com/html

Now that we have our directories, we will reassign ownership of the web directories to our normal user account. This will let us write to them without sudo.

Note: Depending on your needs, you might need to adjust the permissions or ownership of the folders again to allow certain access to the www-data user. For instance, dynamic sites will often need this. The specific permissions and ownership requirements entirely depend on your configuration. Follow the recommendations for the specific technology you’re using.

We can use the $USER environmental variable to assign ownership to the account that we are currently signed in on (make sure you’re not logged in as root). This will allow us to easily create or edit the content in this directory:

(Video) How to Configure Nginx VirtualHost in Ubuntu

  1. sudo chown -R $USER:$USER /var/www/example.com/html
  2. sudo chown -R $USER:$USER /var/www/test.com/html

The permissions of our web roots should be correct already if you have not modified your umask value, but we can make sure by typing:

  1. sudo chmod -R 755 /var/www

Our directory structure is now configured and we can move on.

Step 2 — Creating Sample Pages for Each Site

Now that we have our directory structure set up, let’s create a default page for each of our sites so that we will have something to display.

Create an index.html file in your first domain:

  1. nano /var/www/example.com/html/index.html

Inside the file, we’ll create a really basic file that indicates what site we are currently accessing. It will look like this:

/var/www/example.com/html/index.html

<html> <head> <title>Welcome to Example.com!</title> </head> <body> <h1>Success! The example.com server block is working!</h1> </body></html>

Save and close the file when you are finished. To do this in nano, press CTRL+o to write the file out, then CTRL+x to exit.

Since the file for our second site is basically going to be the same, we can copy it over to our second document root like this:

  1. cp /var/www/example.com/html/index.html /var/www/test.com/html/

Now, we can open the new file in our editor:

  1. nano /var/www/test.com/html/index.html

Modify it so that it refers to our second domain:

/var/www/test.com/html/index.html

<html> <head> <title>Welcome to Test.com!</title> </head> <body> <h1>Success! The test.com server block is working!</h1> </body></html>

Save and close this file when you are finished. We now have some pages to display to visitors of our two domains.

Step 3 — Creating Server Block Files for Each Domain

Now that we have the content we wish to serve, we need to create the server blocks that will tell Nginx how to do this.

By default, Nginx contains one server block called default which we can use as a template for our own configurations. We will begin by designing our first domain’s server block, which we will then copy over for our second domain and make the necessary modifications.

Creating the First Server Block File

As mentioned above, we will create our first server block config file by copying over the default file:

  1. sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com

Now, open the new file you created in your text editor with sudo privileges:

(Video) How To Set Up nginx Virtual Hosts Server Blocks on ubuntu linux

  1. sudo nano /etc/nginx/sites-available/example.com

Ignoring the commented lines, the file will look similar to this:

/etc/nginx/sites-available/example.com

server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name _; location / { try_files $uri $uri/ =404; }}

First, we need to look at the listen directives. Only one of our server blocks on the server can have the default_server option enabled. This specifies which block should serve a request if the server_name requested does not match any of the available server blocks. This shouldn’t happen very frequently in real world scenarios since visitors will be accessing your site through your domain name.

You can choose to designate one of your sites as the “default” by including the default_server option in the listen directive, or you can leave the default server block enabled, which will serve the content of the /var/www/html directory if the requested host cannot be found.

In this guide, we’ll leave the default server block in place to serve non-matching requests, so we’ll remove the default_server from this and the next server block. You can choose to add the option to whichever of your server blocks makes sense to you.

/etc/nginx/sites-available/example.com

server { listen 80; listen [::]:80; . . .}

Note: You can check that the default_server option is only enabled in a single active file by typing:

  1. grep -R default_server /etc/nginx/sites-enabled/

If matches are found uncommented in more than on file (shown in the leftmost column), Nginx will complain about an invalid configuration.

The next thing we’re going to have to adjust is the document root, specified by the root directive. Point it to the site’s document root that you created:

/etc/nginx/sites-available/example.com

server { listen 80; listen [::]:80; root /var/www/example.com/html;}

Next, we need to modify the server_name to match requests for our first domain. We can additionally add any aliases that we want to match. We will add a www.example.com alias to demonstrate.

When you are finished, your file will look something like this:

/etc/nginx/sites-available/example.com

server { listen 80; listen [::]:80; root /var/www/example.com/html; index index.html index.htm index.nginx-debian.html; server_name example.com www.example.com; location / { try_files $uri $uri/ =404; }}

That is all we need for a basic configuration. Save and close the file to exit.

Creating the Second Server Block File

Now that we have our initial server block configuration, we can use that as a basis for our second file. Copy it over to create a new file:

(Video) NGINX Server Blocks - Virtual Hosts

  1. sudo cp /etc/nginx/sites-available/example.com /etc/nginx/sites-available/test.com

Open the new file with sudo privileges in your editor:

  1. sudo nano /etc/nginx/sites-available/test.com

Again, make sure that you do not use the default_server option for the listen directive in this file if you’ve already used it elsewhere. Adjust the root directive to point to your second domain’s document root and adjust the server_name to match your second site’s domain name (make sure to include any aliases).

When you are finished, your file will likely look something like this:

/etc/nginx/sites-available/test.com

server { listen 80; listen [::]:80; root /var/www/test.com/html; index index.html index.htm index.nginx-debian.html; server_name test.com www.test.com; location / { try_files $uri $uri/ =404; }}

When you are finished, save and close the file.

Step 4 — Enabling your Server Blocks and Restart Nginx

Now that we have our server block files, we need to enable them. We can do this by creating symbolic links from these files to the sites-enabled directory, which Nginx reads from during startup.

We can create these links by typing:

  1. sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
  2. sudo ln -s /etc/nginx/sites-available/test.com /etc/nginx/sites-enabled/

These files are now linked into the enabled directory. We now have three server blocks enabled, which are configured to respond based on their listen directive and the server_name (you can read more about how Nginx processes these directives here):

  • example.com: Will respond to requests for example.com and www.example.com
  • test.com: Will respond to requests for test.com and www.test.com
  • default: Will respond to any requests on port 80 that do not match the other two blocks.

In order to avoid a possible hash bucket memory problem that can arise from adding additional server names, we will also adjust a single value within our /etc/nginx/nginx.conf file. Open the file now:

  1. sudo nano /etc/nginx/nginx.conf

Within the file, find the server_names_hash_bucket_size directive. Remove the # symbol to uncomment the line:

/etc/nginx/nginx.conf

http { . . . server_names_hash_bucket_size 64; . . .}

Save and close the file when you are finished.

Next, test to make sure that there are no syntax errors in any of your Nginx files:

  1. sudo nginx -t

If no problems were found, restart Nginx to enable your changes:

  1. sudo systemctl restart nginx

Nginx should now be serving both of your domain names.

Step 5 — Modifying Your Local Hosts File for Testing (Optional)

If you have not been using domain names that you own and instead have been using placeholder values, you can modify your local computer’s configuration to let you to temporarily test your Nginx server block configuration.

(Video) How To Set Up Nginx Server Blocks Virtual Hosts on ubuntu 17.04 zesty zapus

This will not allow other visitors to view your site correctly, but it will give you the ability to reach each site independently and test your configuration. This works by intercepting requests that would usually go to DNS to resolve domain names. Instead, we can set the IP addresses we want our local computer to go to when we request the domain names.

Note: Make sure you are operating on your local computer during these steps and not a remote server. You will need to have root access, be a member of the administrative group, or otherwise be able to edit system files to do this.

If you are on a Mac or Linux computer at home, you can edit the file needed by typing:

  1. sudo nano /etc/hosts

If you are on Windows, you can find instructions for altering your hosts file here.

You need to know your server’s public IP address and the domains you want to route to the server. Assuming that my server’s public IP address is 203.0.113.5, the lines I would add to my file would look something like this:

/etc/hosts

127.0.0.1 localhost. . .203.0.113.5 example.com www.example.com203.0.113.5 test.com www.test.com

This will intercept any requests for example.com and test.com and send them to your server, which is what we want if we don’t actually own the domains that we are using.

Save and close the file when you are finished.

Step 6 — Testing Your Results

Now that you are all set up, you should test that your server blocks are functioning correctly. You can do that by visiting the domains in your web browser:

http://example.com

You should see a page that looks like this:

How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04 | DigitalOcean (1)

If you visit your second domain name, you should see a slightly different site:

http://test.com

How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04 | DigitalOcean (2)

If both of these sites work, you have successfully configured two independent server blocks with Nginx.

At this point, if you adjusted your hosts file on your local computer in order to test, you’ll probably want to remove the lines you added.

If you need domain name access to your server for a public-facing site, you will probably want to purchase a domain name for each of your sites.

(Video) How To Set Up nginx Virtual Hosts (Server Blocks)

Conclusion

You should now have the ability to create server blocks for each domain you wish to host from the same server. There aren’t any real limits on the number of server blocks you can create, so long as your hardware can handle the traffic.

FAQs

How do I create a virtual host in Nginx? ›

Enabling the Nginx virtual host

You need to create a symbolic link to the configuration in the sites-enabled directory to enable the virtual host. Now check the configuration for errors. And restart the service. Now you have a working virtual host for a single domain.

How do I host multiple websites on one Nginx server Ubuntu? ›

Steps to Host Multiple Websites on One Server -NGINX
  1. Create Document Root Directories. You will make two individual document root folders for each domain. ...
  2. Create index. html files. ...
  3. Open NGINX Configuration file. ...
  4. Create Server Blocks. ...
  5. Restart the NGINX Server.
2 Dec 2021

How do I enable available sites in Nginx? ›

To enable a website, you must create a symbolic link inside the /etc/nginx/sites-enabled directory pointing to the actual vhost file in /etc/nginx/sites-available . The nginx. conf file reviews the contents of the sites-enabled directory and determines which virtual host files to include.

How do I create a nginx server block? ›

With all the requirements met, let's explore how you can set up an Nginx server block in Ubuntu.
  1. Step 1: Create an Nginx Document Root Directory. ...
  2. Step 2: Create a Sample Page for the Domain. ...
  3. Step 3: Create an Nginx Server Block in Ubuntu. ...
  4. Step 4: Enable Nginx Server Block in Ubuntu.
29 Jul 2020

How do I add multiple virtual hosts to nginx? ›

The image above shows my /var/www folder. I then used the following command sudo chmod -R 755 /var/www . I then used the following command: sudo ln -s /etc/nginx/sites-available/dev.domain.nl /etc/nginx/sites-enabled/ 3 times for the 3 different subdomains to 'enable' the server blocks.

How do I host multiple websites on one server Ubuntu? ›

  1. Making the file/directory structure. ...
  2. Changing directory ownership. ...
  3. Modify file permissions. ...
  4. Create sample web content for each virtual host/domain. ...
  5. Create the virtual hosts configuration files for our two sites. ...
  6. Enable the two virtual hosts. ...
  7. Restart Apache for the changes to take effect.
7 Jun 2022

Can we run 2 nginx at the same time? ›

Yes, its technically possible to install 2 nginx instances on the same server but I would do it another way. 1 - You could just create multiple EC2 instances. The downside of this approach is that maybe it's gets harder to maintain depending on how many instances you want.

How do I run multiple domains in nginx? ›

  1. Prerequisites.
  2. Setting Up DNS Records.
  3. Setting Up Web Directories for NGINX Domain and Subdomain.
  4. Setting Up Virtual Host for NGINX Domain and Subdomains.
  5. Setting Up HTTPS on NGINX Domain and Subdomain. Configuring NGINX Virtual Host to Use SSL Certificates.
  6. Conclusion.
6 Dec 2021

What is server block in nginx? ›

Server Blocks, often referred to as Nginx virtual host are a feature of the Nginx web server that allows you to host multiple websites on one server. As opposed to setting up and configuring a server for each domain, hosting a number of websites on a single machine saves both time and money.

Where is nginx virtual host? ›

All configuration files for Nginx virtual hosts are stored in the /etc/nginx/sites-available/ folder. The best way is to create a separate file for each web site on the server.

What is the difference between sites available and sites-enabled in nginx? ›

The sites-available folder is for storing all of your vhost configurations, whether or not they're currently enabled. The sites-enabled folder contains symlinks to files in the sites-available folder. This allows you to selectively disable vhosts by removing the symlink.

How configure nginx config file in Ubuntu? ›

How to Install and Configure Nginx on Ubuntu 20.04
  1. Create a Directory for the Test Domain.
  2. Configure Ownership and Permissions.
  3. Create an index.html File for the Server Block.
  4. Create Nginx Server Block Configuration.
  5. Create Symbolic Link for Nginx to Read on Startup.
  6. Restart the Nginx Service.
  7. Test the Configuration.
1 Oct 2020

Where is nginx config Ubuntu? ›

All NGINX configuration files are located in the /etc/nginx/ directory. The primary configuration file is /etc/nginx/nginx. conf .

How do I access nginx config file in Ubuntu? ›

Usually, in Ubuntu, application configurations will be placed in /etc/ the folder. For Nginx, this is /etc/nginx/ by default. The main configuration file will be /etc/nginx/nginx. conf .

How do I create a virtual host? ›

Creating a new virtual host
  1. Step 1 — Create a conf file. Copy 000-default.com.conf to create a new file in /etc/apache2/sites-available : $ cd /etc/apache2/sites-available. ...
  2. Step 2 — Modify the new conf file. In the example.com.conf : ...
  3. Step 3 — Enabling a virtual host. ...
  4. Step 4— Enabling SSL. ...
  5. Step 5— Restart apache.
25 May 2021

How do you block IP address in nginx? ›

Follow these steps to block an IP address.
  1. View the Nginx configuration file locations article to create your local /nginx/example.com directory.
  2. Create a file named access. conf in this /nginx/example.com directory.
  3. Add the contents from the following sections.
  4. Make sure to reload Nginx for the changes to take effect.
13 May 2021

Can nginx listen on multiple ports? ›

To make Nginx Listen on multiple ports for a single virtual host file, you can add multiple listen directives. If you want to make Nginx listen for different virtual hosts on different ports, you can use different ports in listen directive in different virtual host files. It's that easy!

What is an NGINX virtual host? ›

A virtual host is an Apache term, however, is commonly used by Nginx users as well. The proper term for Nginx is server block. Both of these words have the same meaning which is basically the feature of being able to host multiple websites on a single server.

How does NGINX virtual host work? ›

NGINX does not have Virtual hosts, it has “Server Blocks” that use the server_name and listen directives to bind to tcp sockets.

What is Default_server in NGINX? ›

The default server is the first one listed in the nginx. conf file, unless you include the default_server parameter to the listen directive to explicitly designate a server as the default. server { listen 80 default_server; #... }

Can I host multiple websites on one hosting account? ›

Absolutely. With the right type of hosting account, you can host as many websites as your particular hosting package will allow. Be sure to check with your hosting provider before you begin hosting more than one domain.

Can I run two web servers on the same computer? ›

You can run two different servers on the same localhost via different port numbers or two different localhosts on the same port (localhost ranges 127.0. 0.0 - 127.255. 255.255 )

Can you host multiple websites from the same IP? ›

Name-based virtual hosting is the most commonly used method to host multiple websites on the same IP address and Port. You will need valid domain names to host multiple websites using name-based virtual hosting.

How use nginx reverse proxy for multiple servers? ›

How to create reverse proxy for multiple websites in nginx
  1. localhost:8000 => laravel api for user panel.
  2. localhost:8001 => laravel api for admin panel.
  3. localhost:3000 => react client for user panel.
  4. localhost:3001 => nextjs client for site.
  5. localhost:3002 => react client for admin panel.
30 Jun 2021

Can I execute multiple instances of a docker image on the same server? ›

As long as the host has resources (Memory, CPU and Disk), it can host as many docker containers. The command would be the usual one - `docker run …..`

Can you host subdomain on different server? ›

Yes, It's possible. For Example. You would either Contact your Host to set this, or if you have the ability to point DNS your self then do so. Just make sure that the site you want to serve on that subdomain exists on the server that it's pointing to.

What is domain name in nginx? ›

Domains are the unique names that identify websites on the internet. In order to configure Nginx for your domain, you will need to edit the Nginx configuration file to include the domain name. Once you have edited the file, you will need to restart Nginx in order for the changes to take effect.

How do I change my localhost domain to nginx? ›

Change domain. tld by your domain.
  1. Create the virtual host file like this: /etc/nginx/sites-available/domain. tld. conf .
  2. Edit your hosts file in /etc/hosts .
  3. Create the index file to test the configurations like: /var/www/domain. tld/public/index. ...
  4. Create the symlink to enable the virtual host then restart nginx server.

What are the nginx location blocks for? ›

The location directive within NGINX server block allows to route request to correct location within the file system. The directive is used to tell NGINX where to look for a resource by including files and folders while matching a location block against an URL.

How do I use nginx as a file server? ›

Serving static files using nginx as web server is a good option. For making the static files available you need to copy your testfolder to /usr/share/nginx/html inside the nginx image. After which you will be able to see the files on your browser on port 8080.

How do virtual hosts work? ›

The concept of virtual hosts allows more than one Web site on one system or Web server. The servers are differentiated by their host name. Visitors to the Web site are routed by host name or IP address to the correct virtual host. Virtual hosting allows companies sharing one server to each have their own domain names.

How do I fix 403 Forbidden NGINX? ›

However, if the specified index files are not in the directory, Nginx will return 403 forbidden error. One way to resolve this issue is to add the index file specified in the configuration file or add the available index file to the config file.

Where is NGINX config file located? ›

By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .

What is ETC NGINX sites enabled default? ›

/etc/nginx/sites-enabled/default is the path given to the default website for Debian based systems. They are usually links to files contained /etc/nginx/sites-available . /etc/nginx/conf. d is a path used in most configurations including Debian derivatives like Ubuntu and other distro's like CentOS etc.

Should I edit sites-enabled or sites-available? ›

Important information. If you are still using sites-available/sites-enabled pattern, you should edit files only in the sites-available directory. Never edit files inside the sites-enabled directory. Otherwise you can have problems if your editor runs out of memory or, for any reason, it receives a SIGHUP or SIGTERM.

How do I check my nginx status? ›

Through a simple command you can verify the status of the Nginx configuration file: $ sudo systemctl config nginx The output will show if the configuration file is correct or, if it is not, it will show the file and the line where the problem is.

What is Conf d file in nginx? ›

conf . /etc/nginx/conf. d/default. conf is used to configure the default virtual host. For this you can also use sites-available and sites-enabled . You can find more details at a blog entry from digital ocean How To Configure The Nginx Web Server On a Virtual Private Server.

How do I create a virtual host? ›

Creating a new virtual host
  1. Step 1 — Create a conf file. Copy 000-default.com.conf to create a new file in /etc/apache2/sites-available : $ cd /etc/apache2/sites-available. ...
  2. Step 2 — Modify the new conf file. In the example.com.conf : ...
  3. Step 3 — Enabling a virtual host. ...
  4. Step 4— Enabling SSL. ...
  5. Step 5— Restart apache.
25 May 2021

What is a virtual host in nginx? ›

Server blocks, often called virtual hosts in Nginx, allow you to host multiple websites on a single server. Here's how to use them!

How does nginx virtual host work? ›

NGINX does not have Virtual hosts, it has “Server Blocks” that use the server_name and listen directives to bind to tcp sockets.

How do virtual hosts work? ›

The concept of virtual hosts allows more than one Web site on one system or Web server. The servers are differentiated by their host name. Visitors to the Web site are routed by host name or IP address to the correct virtual host. Virtual hosting allows companies sharing one server to each have their own domain names.

How do I host multiple websites on one server Ubuntu? ›

  1. Making the file/directory structure. ...
  2. Changing directory ownership. ...
  3. Modify file permissions. ...
  4. Create sample web content for each virtual host/domain. ...
  5. Create the virtual hosts configuration files for our two sites. ...
  6. Enable the two virtual hosts. ...
  7. Restart Apache for the changes to take effect.
7 Jun 2022

How do I host a website on Ubuntu server? ›

Install and Configure Apache Web Server on Ubuntu 20.04
  1. Step 2: Install Apache2. ...
  2. Step 1: Create a directory for your domain. ...
  3. Step 2: Make a sample page for your website. ...
  4. Step 3: Create a virtual host file. ...
  5. Step 4: Activate virtual host configuration file. ...
  6. Step 5: Test for errors. ...
  7. Step 6: Test virtual host.

Where is virtual hosts file? ›

Configuration settings of each virtual host are stored in its configuration files in the /var/www/vhosts/system/ <domain_name> /conf/ directory.

What are Nginx server blocks? ›

Nginx Server Blocks allows you to run more than one website on a single machine. With Server Blocks, you can specify the site document root (the directory which contains the website files), create a separate security policy for each site, use different SSL certificates for each site, and much more.

Where is virtual host file Nginx? ›

All configuration files for Nginx virtual hosts are stored in the /etc/nginx/sites-available/ folder. The best way is to create a separate file for each web site on the server.

Can Nginx have multiple server? ›

Alternatively, you can also add the 2 server blocks to NGINX's default configuration file at /etc/nginx/nginx. conf if you want to configure multiple host names in NGINX. However, it is advisable to create separate copies for better security & management, if you want to host multiple websites on NGINX.

How do I access nginx config file in Ubuntu? ›

Usually, in Ubuntu, application configurations will be placed in /etc/ the folder. For Nginx, this is /etc/nginx/ by default. The main configuration file will be /etc/nginx/nginx. conf .

Can nginx listen on multiple ports? ›

To make Nginx Listen on multiple ports for a single virtual host file, you can add multiple listen directives. If you want to make Nginx listen for different virtual hosts on different ports, you can use different ports in listen directive in different virtual host files. It's that easy!

How do I fix 403 Forbidden nginx? ›

However, if the specified index files are not in the directory, Nginx will return 403 forbidden error. One way to resolve this issue is to add the index file specified in the configuration file or add the available index file to the config file.

What is virtual host configuration? ›

A virtual host is a configuration entity that allows WebSphere® Application Server to treat multiple host machines or port numbers as a single logical host (virtual host) for configuration purposes. Each virtual host can be associated with multiple aliases. Each alias is a particular host name and port number.

What is the difference between virtual host and virtual machine? ›

A virtual machine (VM), typically has two components : the host and the guest. The host is the virtual machine host server; the underlying hardware that provides computing resources, such as processing power, memory, disk and network I/O, and so on.

What is IP-based virtual hosting? ›

IP-based virtual hosting is a method to apply different directives based on the IP address and port a request is received on. Most commonly, this is used to serve different websites on different ports or interfaces.

Videos

1. How to Configure Nginx Virtual Host | Nginx Server Block | Nginx Virtual Host Tutorial
(AR IT Experts)
2. How to configure Virtualhost in Nginx in Ubuntu 16 04
(Techs2resolve)
3. How to Configure Nginx Virtual-host in OpenBSD
(LinuxHelp)
4. How To Set Up Nginx Server Blocks Virtual Hosts on Ubuntu 14.04
(Quick Notepad Tutorial)
5. How to create virtual host in NGINX (Both Name and IP based)
(LinuxHelp)
6. How to Create Virtual Host in Nginx | What is use of Virtual Host in Nginx
(Server Gyan)
Top Articles
Latest Posts
Article information

Author: Ms. Lucile Johns

Last Updated: 12/16/2022

Views: 6088

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.