0

I already have a Working nginx installation for my local development in my Computer. So i was thinking about adding another virtual host for a new project. Here is the Existing Virtual host file AKA the Default one.

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /home/oritro/work;
index index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name localhost;

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

}

Then i Copied it, and Edited it for the New Virtual Hots,

server {
listen 1993 ;
listen [::]:1993 ipv6only=on;

root /home/oritro/smf;
index index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name local.smf;

location ~ \.php$ {
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

}

Then i symlinked it to sites-enabled and Restarted nginx. From my previous experience, nginx won't restart if their is something wrong with the configuration. Fortunately, it restarted.

Before adding it to my host file, I thought about accessing it directly. But nothing comes up on http://localhost:1993 or http://127.0.0.1:1993. I am a bit confused here. What did i do wrong? Or what am i missing?

7
  • Is the service listening on port 1993? Can you open a connection to it? What error does your browser show? Apr 1, 2014 at 2:41
  • Browser cant find Server. And Terminal is showing unknown host. Apr 1, 2014 at 2:58
  • 127.0.0.1 is an unknown host? That's.. a bit off. Can you provide the exact command you're running and the output? Apr 1, 2014 at 3:03
  • Ow, No. 127.0.0.1 Is working fine. But when i am trying to locate or ping 127.0.0.1:1993 or localhost:1993, its showing unknown host. Apr 1, 2014 at 3:05
  • Ahh, gotcha - the port number won't work as part of the hostname, so that's fine. How about connecting to the port with telnet or netcat (space separated from the hostname) or loading the URL with wget? Apr 1, 2014 at 3:09

1 Answer 1

-1

You have IPv6 only configuration specified, thus accessing by 127.0.0.1 (which is IPv4 IP) should not work.

Try using IPs (127.0.0.1 and ::1) instead. To access non-standard port on IPv6 use this (note the brackets):

Second server:

http://[::1]:1993

First server:

http://127.0.0.1

Update

Also do these changes:

  • listen 80 default_server; to listen 80; in your first server's configuration.
  • Remove server_name localhost;
2
  • Didn't worked ! Apr 1, 2014 at 16:17
  • see update, hope that helps.
    – ek9
    Apr 1, 2014 at 20:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .