logo

Contact us

Blogs

How to create and deploy server blocks file

The server block file tells the nginx engine what is our server name/domain name, and to which port to listen internally.

logo

You can download a sample server block file from here

Naming server block file

If your domain name is abcdefg.com then it is important to name your server block file in the same manner.

The domain name used in the above example is letscode.xyz and the server block file name is also named in the same manner, letscode.xyz, ignore www prefix when naming server block file name same as domain name.

Server Name

In the above example in line 2, we have declared our server_name as letscode.xyz, in similar manner input your domain name accordingly.

Port Location

When a request is made to the domain name, it will be routed to our DNS and then to our IP address and then from there, our nginx server will forward the request to the mentioned localhost port number in the server block file, the location mentioned in line 5, is what the nginx server will forward the request to, in the above example, it is localhost:3000. So you should ensure that your app is listening to localhost:3000 when you deploy your application.

logo

© 2022 AutoCodeGen. All rights reserved

Company

About usOur BlogsContact Us