This is a virtual host issue. You’ve configured nginx to only serve specific
virtual hosts using your site, and the rest are handled by the default site.

With vagrant share, the virtual host sent is actually that funky name, so 
visiting
“http://funky-panda-1234.vagrantshare.com” is actually going to to use the 
“funky-panda-1234”
as the vhost.

Hope that helps!

Best Regards,
Armon Dadgar

From: Jeanmichel Cote [email protected]
Reply: [email protected] [email protected]
Date: March 28, 2014 at 6:09:00 AM
To: [email protected] [email protected]
Subject:  Re: [vagrant-up] Vagrant share's funky url stuck on the " Welcome to 
Nginx" page  

Yeah, i tried already the vagrantshare.com option, i even tried to add the 
whole temporary funky share url. But i didnt help.

And your right about the default file. I dont know why but accessed from the 
web, my nginx serves the default file rather than the mysite file.

I'm gonna go ahead an try disabling the default site, as you suggest.

I'll be back later today...

thanks!

Le vendredi 28 mars 2014 14:04:02 UTC+1, Terrance Shepherd a écrit :
So it will actually work but it collides with the file 
/etc/nginx/sites-enabled/000-default which is what returns the "Welcome to 
Nginx page" you would need to disable the default site first. 

You can disable the default site by running:
nginx_dissite 000-default

If that still does not work you can add *.vagrantshare.com to the server_name 
parameter

*note the 000-default might be different in your environment.


On Fri, Mar 28, 2014 at 8:55 AM, Jeanmichel Cote <[email protected]> wrote:
If i do
server_name *;

nginx server wont restart.
Which means "sudo service nginx restart" wont work.

Nice try ;)

Le vendredi 28 mars 2014 13:19:38 UTC+1, Alvaro Miranda Aguilera a écrit :
what happen if you put

        server_name *


On Sat, Mar 29, 2014 at 1:05 AM, Jeanmichel Cote <[email protected]> wrote:
Well, thanks for answering. You may be right. But i'm not sure about that yet.
Here's my nginx code:

   server {
        listen 80;
        server_name mysite.com www.mysite.com;
        root /vagrant/public;  
        rails_env development;
        passenger_enabled on;
        client_max_body_size 100M;
        if ($host ~* www\.(.*)) {
            set $host_without_www $1;
            rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains 
'/foo', not 'www.mydomain.com/foo'
        }
    }

Now i know its best not to use if statements but i'm on a closed circuit mode 
running that particular code only in my VM server.
Otherwise the
 return 301 $scheme://mysite.com$request_uri;

breaks entirely the access by trying to redirect to the actual live site, which 
means that i dont know how to make that statement redirect with a port number. 
I tried
 return 301 $scheme://mysite.com:8080$request_uri;

but its bad redirection.

So i'll keep on digging...


Le vendredi 28 mars 2014 12:02:02 UTC+1, Terrance Shepherd a écrit :
This is probably a problem with nginx and you code then vagrant.

>From here my guess is that your nginx config is only set up to respond with 
>your code if you access it from mysite.com  and so changing your nginx config 
>by removing server line will probably fix this.

On Mar 28, 2014 4:12 AM, "Jeanmichel Cote" <[email protected]> wrote:
Hi,

i just set myself a nice vagrant local development of a website that is online 
at the moment. I've forwarded ports 8080 on host to 80 on guest, tweaked my 
host's hosts file adding 127.0.0.1 mysite.com and i configured my nginx 
accordingly so instead of visiting localhost:8080, i go to mysite.com:8080 and 
the site is right up. Good.

So i thought, great, now i want to show the client some modifications i just 
made to his site. Vagrant share then gives me a funky url which i go visit in a 
browser.

The thing is that even though it worked just fine on mysite.com:8080, by using 
vagrant share's url it just throws the "Welcome to Nginx!" page, as if it 
couldnt read my mysite file in /etc/nginx/sites-enabled/mysite.

I hope i made myself clear enough so that it ring someone's bell. If you have 
any info about this, it would help a lot.

Thanks!
--
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to