Multiple localhost website on nginx ubuntu

I have installed LEMP stack on my PC and installed WordPress on localhost with the following details

listen 80;
root /var/www/site1;
server_name localhost; 

Now I made a second folder /var/www/site2 and Site2 is in it but I am lost on what to use in server bloc

Create a new block and keep server_name at the top.

server {
    server_name .site2.com;
    listen         80;
...
1 Like

Will this work for the localhost, I do not have any domains?

Edit: Used a dummy domain site2.localhost and placed it on top, but it redirected to the localhost.

Edit: It worked, there was a typo.

Glad it’s resolved now.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.