Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I was just following the tutorial here. It says there:

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 {
     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

share|improve this question

1 Answer 1

Add the ip address to the listen directive before the port. You might have to define your virtual hosts as the default server. See: How Nginx processes a request

Remove the first section of your server file and replace the first two lines of the second section with this using your ip address.

server {
listen xxx.xxx.xxx:80;
servername _;
share|improve this answer
and how would I go in accessing this "site"? –  EquinoX Feb 28 '11 at 3:59
With the ip address –  Chris_O Feb 28 '11 at 4:07
what if I want to make it ip address/example –  EquinoX Feb 28 '11 at 4:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.