Preamble: I hope people on this list will tolerate a question that, while *motivated* by RoR, is not strictly *about* RoR. I''m trying to let colleagues see a RoR site I''m developing, so I need to share the pages. I''m an academic, and doing this experimentally, so commercial hosting is not a possibility. I''d like to host the page on my desktop machine, as I''ve been doing for years with (cough) PHP pages. It seems that mongrel won''t let me share outside the box, and all the advice suggests that I should be using apache2. I''ve followed along with quite a few tutorials for installation and configuration, and things are working fine locally. The problem is with sharing. Problem: If I use the control-panel to turn web-sharing OFF, the system uses apache-2, but it does NOT share pages to the outside world. If I turn sharing ON, then it shares to the world, *but* it uses apache-1. Question: Is there a trick to making the system share out apache-2 pages? Details: I''ve created a startup item as described at http://developer.apple.com/tools/subversionxcode.html. The system PATH starts with /opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin. A "ps aux" reveals that if web-sharing is turned OFF, then I get the apache-2 versions of httpd, but that if it''s turned ON, I get these, but *also* apache-1 versions. This is why I think what I need to do is to trick the web-sharing part of the control panel. PS: again, I''m sorry to be asking a question that is not strictly about RoR. I''m hoping it will be tolerated here, since it''s my guess that there are others in the same boat. Surely it will be good for RoR when folks can share pages easily from local machines, as they can with (again, cough) PHP. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Kelley wrote:> Preamble: I hope people on this list will tolerate a question that, > while *motivated* by RoR, is not strictly *about* RoR. I''m trying to > let colleagues see a RoR site I''m developing, so I need to share the > pages. I''m an academic, and doing this experimentally, so commercial > hosting is not a possibility. I''d like to host the page on my desktop > machine, as I''ve been doing for years with (cough) PHP pages. It seems > that mongrel won''t let me share outside the box, and all the advice > suggests that I should be using apache2. I''ve followed along with quite > a few tutorials for installation and configuration, and things are > working fine locally. The problem is with sharing.You can use mongrel as your "outwards" facing Web server -- just don''t give it an "-a" parameter. E.g. this restricts mongrel to "localhost" port 8000 only: mongrel_rails start -d -p 8000 -a 127.0.0.1 -e production This exposes mongrel to the outside world: mongrel_rails start -d -p 8000 -e production -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks. Is there a trick to the URL, afterwards? For example, I do mongrel_rails start -d -p 8000 -e production but when I point to http://(host):8000/(page) it doesn''t respond, *except* if I''m accessing via the host machine. Michael Wang wrote:> This exposes mongrel to the outside world: > > mongrel_rails start -d -p 8000 -e production > > > -- > Michael Wang-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Kelley wrote:> Thanks. Is there a trick to the URL, afterwards? For example, I do > > mongrel_rails start -d -p 8000 -e production > > but when I point to > > http://(host):8000/(page) > > it doesn''t respond, *except* if I''m accessing via the host machine.Start Mongrel and do something like: netstat --tcp --all --numeric | less and look for the local address that''s bound to port 8000. Is it 0.0.0.0:8000 or some internal-only facing IP address? -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The netstat seems to take different arguments to those suggested. Anyway, if I do netstat -a -n I see the line tcp4 0 0 *.8000 *.* LISTEN and I wonder if that tells me something? (I''m sorry to be such a pain, but you see, you''ve got me all excited, thinking that I may get this working today, after a long time of trying. Hence, I hope you''ll excuse my ignorance.) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Kelley wrote:> The netstat seems to take different arguments to those suggested. > Anyway, if I do > > netstat -a -n > > I see the line > > tcp4 0 0 *.8000 *.* > LISTEN > > and I wonder if that tells me something? (I''m sorry to be such a pain, > but you see, you''ve got me all excited, thinking that I may get this > working today, after a long time of trying. Hence, I hope you''ll excuse > my ignorance.)Alright it''s been a while since I''ve used BSD but that looks okay so the next question is, do you have a firewall running? It sounds like there''s something running on OS X that handles opening and closing ports for you which is probably why Mongrel isn''t being seen by the outside world. At this point it may be easier to just hook Mongrel up through Apache. Unfortunately I''m also not an OS X user so I can''t tell you how to fiddle with that Control Panel and the different versions of Apache you have installed to get that to work with Apache 2. If you want to try it with Apache 1.3 you can do something like this. Setup Mongrel with the -a switch and set it to 127.0.0.1 like in my previous example. Then in your Apache httpd.conf file you would have something like: <VirtualHost *:80> ServerName myapp.com ServerAlias www.myapp.com ProxyPass / http://127.0.0.1:8000/ ProxyPassReverse / http://127.0.0.1:8000 </VirtualHost> Change ServerName and ServerAlias as appropriate or leave them that way if you just want somebody to access your box by your IP. The ProxyPass and ProxyPassReverse directives requires that you have the mod_proxy module installed so you''ll need to check for these two lines in httpd.conf: LoadModule proxy_module libexec/libproxy.so AddModule mod_proxy.c The above instructions work on Linux but I don''t know if OS X handles the Apache config differently. -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m starting to see light at the end of this tunnel... Do I need to do any tricks with directories? If I do as suggested (proxying to "/"), then I lose the rest of the machine''s pages. So I tried as at the end of this post. This halfway works: if I browse to "http://(MY_HOST)/myapp/(A_PAGE)", where "A_PAGE" is the name of a page in my app, then I get the page, but no style sheet. Also, the links in the page don''t work. The links are going to e.g. "http://(MY_HOST)/(ANOTHER_PAGE)", i.e. the "myapp" part is missing in the links. The link/css issues seem to stem from a problem in the construction of relative filenames. Q: Is there an additional trick with apache? BTW, I also tried proxying to "/myapp", i.e. without the trailing slash, but that leads to "page does not exist" errors on all but the rails-supplied "welcome aboard" page. OK, so here is what I have so far. I''ve done the other suggested things to my http.conf, and it passes cleanly through a /usr/sbin/apachectl stop/configtest/start cycle (NB. I''m here being careful to use apache 1.3, not the apache 2.0 that I had previously thought I would be required to use, which is how this thread got started!) <VirtualHost *:80> ServerName myapp.com ServerAlias myapp.com ProxyPass /myapp/ http://127.0.0.1:8000/ ProxyPassReverse /myapp/ http://127.0.0.1:8000/ </VirtualHost> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Addendum: the style sheet gets used if I add DocumentRoot (PATH_TO_MY_APP)/public but the links are still broken. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Kelley wrote:> I''m starting to see light at the end of this tunnel... > > Do I need to do any tricks with directories? If I do as suggested > (proxying to "/"), then I lose the rest of the machine''s pages. So I > tried as at the end of this post. This halfway works: if I browse to > "http://(MY_HOST)/myapp/(A_PAGE)", where "A_PAGE" is the name of a page > in my app, then I get the page, but no style sheet. Also, the links in > the page don''t work. The links are going to e.g. > "http://(MY_HOST)/(ANOTHER_PAGE)", i.e. the "myapp" part is missing in > the links. > > The link/css issues seem to stem from a problem in the construction of > relative filenames. > > Q: Is there an additional trick with apache? > > BTW, I also tried proxying to "/myapp", i.e. without the trailing slash, > but that leads to "page does not exist" errors on all but the > rails-supplied "welcome aboard" page. > > OK, so here is what I have so far. I''ve done the other suggested things > to my http.conf, and it passes cleanly through a /usr/sbin/apachectl > stop/configtest/start cycle (NB. I''m here being careful to use apache > 1.3, not the apache 2.0 that I had previously thought I would be > required to use, which is how this thread got started!) > > <VirtualHost *:80> > ServerName myapp.com > ServerAlias myapp.com > ProxyPass /myapp/ http://127.0.0.1:8000/ > ProxyPassReverse /myapp/ http://127.0.0.1:8000/ > </VirtualHost>Okay two more changes. In your httpd.conf setup change it to: <VirtualHost *:80> ServerName myapp.com ServerAlias myapp.com ProxyPass /myapp http://127.0.0.1:8000/myapp ProxyPassReverse /myapp http://127.0.0.1:8000/myapp </VirtualHost> Then in your command line that starts Mongrel (you''ll need a recent version of Mongrel for this) you need to add: --prefix /myapp E.g.: mongrel_rails start -d -p 8000 \ -a 127.0.0.1 \ -e production \ --prefix /myapp -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Michael, you''re a gem. Links work, and the style sheet is being obeyed. The one remaining problem is images -- they are not showing up. PS. I have Mongrel Web Server 1.0.1 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Kelley wrote:> Michael, you''re a gem. Links work, and the style sheet is being obeyed. > > The one remaining problem is images -- they are not showing up.That should work with just the DocumentRoot pointing to the public directory within the VirtualHost directive. Did you put the images somewhere else? When you view the source of the page, what path is it using for the images? You could try something like this within VirtualHost: ProxyPass /myapp/images ! Alias /myapp/images /path/to/public/images assuming it''s trying to use /myapp/images as the path to the images in the source. -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Um, none of the following works. My images are in (MY_APP)/public/images. # test 1 ProxyPass /images ! Alias /images (APP_PATH)/public/images # test 2 ProxyPass /(APPNAME)/images ! Alias /(APPNAME)/images APP_PATH)/public/images # test 3 ProxyPass /(APPNAME)/public/images ! Alias /(APPNAME)/public/images APP_PATH)/public/images Michael, you''re being amazingly patient with this. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Kelley wrote:> Um, none of the following works. My images are in > (MY_APP)/public/images. > > > # test 1 > ProxyPass /images ! > Alias /images (APP_PATH)/public/images > > # test 2 > ProxyPass /(APPNAME)/images ! > Alias /(APPNAME)/images APP_PATH)/public/images > > # test 3 > ProxyPass /(APPNAME)/public/images ! > Alias /(APPNAME)/public/images APP_PATH)/public/imagesWhere are you setting DocumentRoot? Do you have any funky mod_rewrite stuff (RewriteCond, RewriteRule, etc.) going on? If you view source on one of your Rails pages with an image, what''s the URL it is trying to access? -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Where are you setting DocumentRoot?I''m not setting DocumentRoot inside the <VirtualHost>, because I found that if I did so, my other pages disappeared.> Do you have any funky mod_rewrite > stuff (RewriteCond, RewriteRule, etc.) going on?Well, nothing that I have set myself. I do see the following in the file, though. <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_METHOD} ^TRACE RewriteRule .* - [F] </IfModule>> If you view source on one of your Rails pages with an image, what''s the > URL it is trying to access?The images are being accessed from the stylesheet. I should have pointed that out. For example, in (MY_APP)/public/stylesheets/style.css I have a line like the following: background-image: url(''/images/background-01.jpg''); -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Kelley wrote:>> Where are you setting DocumentRoot? > > I''m not setting DocumentRoot inside the <VirtualHost>, because I found > that if I did so, my other pages disappeared. > >> Do you have any funky mod_rewrite >> stuff (RewriteCond, RewriteRule, etc.) going on? > > Well, nothing that I have set myself. I do see the following in the > file, though. > > <IfModule mod_rewrite.c> > RewriteEngine On > RewriteCond %{REQUEST_METHOD} ^TRACE > RewriteRule .* - [F] > </IfModule> > > >> If you view source on one of your Rails pages with an image, what''s the >> URL it is trying to access? > > The images are being accessed from the stylesheet. I should have > pointed that out. For example, in > > (MY_APP)/public/stylesheets/style.css > > I have a line like the following: > > background-image: url(''/images/background-01.jpg'');Okay try it like this: ProxyPass /images http://127.0.0.1:8000/myapp/images with no Alias -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
*success* at last! Michael, thank you *so* much for your very generous help, and for your patience through so many exchanges. For the sake of anyone else who is trying this, below I''ve got the recipe that worked for me. Here, MYAPP stands for the application name and URL stands for the URL of the application (although I haven''t used that). 1. SYSTEM DESCRIPTION OSX + Apache-1.3 + mongrel_rails-1.0.1 rails-1.2.2 2. INSTRUCTIONS 2.1 Setup Add the /private/etc/httpd.conf, where MYAPP is the name of the application. <VirtualHost *:80> ServerName MYAPP.com ServerAlias MYAPP.com ProxyPass /MYAPP http://127.0.0.1:8000/MYAPP ProxyPassReverse /MYAPP http://127.0.0.1:8000/MYAPP ProxyPass /images http://127.0.0.1:8000/MYAPP/images </VirtualHost> Then do /usr/sbin/apachectl stop /usr/sbin/apachectl configtest /usr/sbin/apachectl start and be sure that there are no errors. 2.2 Start the server Run the following to start the server mongrel_rails start -d -p 8000 -a 127.0.0.1 -e production --prefix /MYAPP 3. CONCLUSIONS Some people are awfully nice on the web, helping out strangers :-) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Kelley wrote:> *success* at last! Michael, thank you *so* much for your very generous > help, and for your patience through so many exchanges.It probably would''ve been easier to ask an OS X guru how to open up a port for Mongrel :D -- Michael Wang --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---