Nginx.conf questions

I was following the tutorial here. It says
This will create the virtual host file for Nginx in the sites-available
directory. Simply paste the following into the file and change each
instance of example.com to your sites domain name:
server {
listen 80;
server_name www.example.com;
rewrite ^/(.*) http://example.com/$1 permanent;
}

server {
listen 80;
server_name example.com;

 access_log /var/www/example.com/logs/access.log;
 error_log /var/www/example.com/logs/error.log;

 location / {
      root   /var/www/example.com/public/;
      index  index.html;
      }

}
The problem is that I don’t have a domain name, I have an ip address…
so what should I change example.com to? I tried changing it to my ip
address, but it doesn’t work

However, I don’t have a domain name… I have an IP… what if I want to
make this as a subdomain, say xxx.xxx.xxx.xxx/exampleHow can I do that?

Just skip the “server_name example.com;” bit.

You don’t need the rewrite server for IP address based server.

server {
listen 80;
root /path/to/your/document/root/;

access_log /path/to/where/you/want/to/keep/your/access.log;
error_log //path/to/where/you/want/to/keep/your/error.log;

location /example/ {
index index.html;

}

location / {
index index.html;

}

}

Posted at Nginx Forum: