Welcome! Log In Create A New Profile

Advanced

Re: create a virtual-host (server block)

All files from this thread

File Name File Size   Posted by Date  
569 bytes open | download Olivier Morel 11/09/2012 Read message
Francis Daly
November 08, 2012 06:38PM
On Fri, Nov 09, 2012 at 12:19:09AM +0100, Olivier Morel wrote:

Hi there,

> I try to put a virtual host (server block) on my website, i have some issue.
>
> I have read the nginx tutorial for creat server block but after a lot of
> time i can't get my server block and i dont understand why.

What do you do; what do you see; what do you expect to see?

Be specific.

> Do you have something to configure on /etc/hosts or resolv.conf ?

http://nginx.org/en/docs/http/request_processing.html

When your client makes a http request of nginx, nginx must decide which
of your server{} blocks to use to process the request.

For your config, it looks like nginx does this purely based on the http
Host: header.

> *server {
> listen 80;
> server_name sd-32587.dedibox.fr;# localhost;

If you do

curl -H Host:sd-32587.dedibox.fr -i http://your-server-name-or-ip/

you should get content from here.

If sd-32587.dedibox.fr resolves to your server ip, then that is the same as

curl -i http://sd-32587.dedibox.fr/

and the same as using any browser to fetch it.

> *server {
> listen 80 ;
> server_name websvn.sd-32587.dedibox.fr; #websvn.localhost

Same thing here:

curl -H Host:websvn.sd-32587.dedibox.fr -i http://your-server-name-or-ip/

or

curl -i http://websvn.sd-32587.dedibox.fr/

> when i m going to *websvn.sd-32587.dedibox.fr* i have an error .

What error? I suggest using "curl" for testing, as above. It tends not
to hide the real error from you.

My guess is "unable to resolve the hostname".

> Could you help me please

If the problem is that your client can't resolve the hostname, you must
make your client be able to resolve the hostname.

Either put it in dns (so everyone who uses that dns service can see it);
or put it in the local "hosts" file that your browser uses (so that only
you can easily see it).

Good luck,

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

create a virtual-host (server block)

Olivier Morel November 08, 2012 06:20PM

Re: create a virtual-host (server block)

Francis Daly November 08, 2012 06:38PM

Re: create a virtual-host (server block) Attachments

Olivier Morel November 09, 2012 04:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 178
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready