# Nginx.conf questions

**URL:** <https://www.ruby-forum.com/t/nginx-conf-questions/203818>\
**Category:** NGINX\
**Created:** [February 28, 2011, 5:52am UTC](https://www.ruby-forum.com/t/nginx-conf-questions/203818 "2011-02-28T05:52:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 28, 2011, 5:52am UTC](https://www.ruby-forum.com/t/nginx-conf-questions/203818/1 "2011-02-28T05:52:42Z")

</div>

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](http://example.com) to your sites domain name:  
server {  
listen 80;  
server\_name [www.example.com](http://www.example.com);  
rewrite ^/(.\*) [http://example.com/$1](http://example.com/$1) permanent;  
}

server {  
listen 80;  
server\_name [example.com](http://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](http://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?

---

<div class="post-metadata">

**Author:** ![aditya\_h](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e36b37/32.png) [@aditya\_h](https://www.ruby-forum.com/u/aditya_h)\
**Post date:** [February 28, 2011, 5:24pm UTC](https://www.ruby-forum.com/t/nginx-conf-questions/203818/2 "2011-02-28T17:24:41Z")

</div>

Just skip the “server\_name [example.com](http://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:

> **[Re: nginx.conf questions](https://forum.nginx.org/read.php?2,179005,179197#msg-179197)**
>
> 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 site’s domain name: server {...
