[Nitro] Nitro on Apache2 (Tutorial)

Michael Fellinger m.fellinger at gmail.com
Wed Oct 26 19:08:07 EDT 2005


Now that's something i can use :)

a big, fat thank you from me - i will try to make a guide out of the stuff you 
gave me in the next few days, maybe adding fcgi later on when i find out how 
it works.

so, finally have to get some sleep (ep, when you read that, check the /rep 
please).

good night everyone, and keep up the good work
manveru...

Am Mittwoch 26 Oktober 2005 23:30 schrieb James Britt:
> Michael Fellinger wrote:
> > I have encountered enough tutorials wich are platform-specific, but it
> > feels good when it is your platform that is in the tutorial...
> > but you are right - let describing the installation of apache to the
> > apache-people.
> > since ruby is platform-independent it shouldn't be too much of a problem
> > to get the most of the tutorials and guides independent as well. The
> > problem is not only the different flavors of linux, but the whole process
> > is different for example on windows. It requires a good skill of the
> > author of the tutorial to stay agnostic of the platform he/she is working
> > on, and it requires a lot of testing so it works on every machine like
> > described.
> >
> >
> > But regarding the Apache2-tutorial, could you please send me a copy of
> > your apache2.conf, or describe the process of getting nitro running on
> > apache2? It would be a great help for me, and i would love to get the
> > guide as well as the configuration on my machine finished.
> >
> > thx in prev.
> > manveru
>
> I'm running this under Apache2 on a Red Hat Enterprise Linux box, as set
> up by EV1 hosting.  It is integrated with Plesk admin software, so the
> configuration is done in 2 parts.  (If you make changes through Plesk,
> it rewrites some files, so customization must be done in special
> #include files.)
>
> So, the default httpd.conf file for my virtual host looks like this:
> (Certain names and numbers have been altered, and I've stripped out some
> directory aliases that probably do not apply to most people)
>
> (The IP number here is the IP of your Web server listens on.)
>
> # httpd.conf
> <VirtualHost 123.45.206.37:80>
>    ServerName   www.thevirtualdomain.COM:80
>    ServerAlias   *.thevirtualdomain.COM:80
>    # That's if you want to respond to any and all subdomains,
>    # but you may need some DNS tweaking, which is a topic for
>    # another day.  :)
>
>
>    SuexecUserGroup      the_user  psacln
>    ServerAdmin  "your.mail at gmail.com"
>    DocumentRoot /home/httpd/vhosts/thevirtualdomain.com/httpdocs
>    CustomLog
> /home/httpd/vhosts/thevirtualdomain.com/statistics/logs/access_log plesklog
>    ErrorLog
> /home/httpd/vhosts/thevirtualdomain.com/statistics/logs/error_log
>    ScriptAlias  /cgi-bin/ /home/httpd/vhosts/thevirtualdomain.com/cgi-bin/
>     <IfModule mod_ssl.c>
>      SSLEngine off
>    </IfModule>
>    <Directory /home/httpd/vhosts/thevirtualdomain.com/httpdocs>
>    <IfModule sapi_apache2.c>
>      AddType text/plain .php .php4 .php3 .phtml
>      php_admin_flag engine off
>    </IfModule>
>      Options -Includes +ExecCGI
>    </Directory>
>    Include /home/httpd/vhosts/thevirtualdomain.com/conf/vhost.conf
> </VirtualHost>
>
>
> So, basically, this tells Apache that the root for all requests to the
> domain thevirtualdomain.com is in the actual directory
> /home/httpd/vhosts/thevirtualdomain.COM/httpdocs
>
> However, depending on how you set up and develop with Nitro, you may
> have the root folder someplace else.  In my case, I need to tell Apache
> to look elsewhere for the root, so I out additional commands in vhost.conf
>
> (This seems to be somewhat of a common approach.  Some admin define
> common defaults in htttpd.conf, with an include directive to an
> additional file where users can put custom directives.)
>
> So, vhost.conf contains directives that either add on to what has
> already been configured, or, in the case of duplicate directives,
> override the previous value.  I first need to tell Apache where the real
> document root is, and then tell it the execute certain files as CGI:
>
> # vhost.conf
>    DocumentRoot /home/httpd/vhosts/thevirtualdomain.com/httpdocs/public
>    <Directory /home/httpd/vhosts/thevirtualdomain.com/httpdocs/public >
>      RewriteEngine On
>      <Files ~ "\.(rb|rbx|cgi|pl)$" >
>         SetHandler cgi-script
>      </Files>
>      Options -Includes +ExecCGI
>    </Directory>
>
>
> Now, one last step.  I also have an .htaccess file in the 'public'
> directory (i.e, the document root for my web site).  The contents could
> go into either of those .conf files, but I find it easier to tweak the
> .htaccess file for rewrite hacks ( avoiding having to su, edit files,
> bounce Apache, and such.)
>
>    RewriteEngine On
>    RewriteRule ^$ index.html [QSA]
>    RewriteRule ^([^.]+)$ $1.html [QSA]
>    RewriteCond %{REQUEST_FILENAME} !-f
>    RewriteRule ^(.*)$ cgi.rb [QSA,L]
>
>
> And one small note.  Certain server configurations are quite security
> conscious.  I learned, after much head scratching, that if I make ny
> *.rb files too-freely executable, they would not run (actully, they
> raised the useless "malformed header" CGI error).  Only chmod u+x was
> acceptable.  chmod ug+x or ugo+ was Bad.
>
> I've not gotten fastcgi on Apache2 running yet, but do have a Rails app
> running on the same box with lighttpd + fastcgi.
>
>
> Hope this helps, and apologies if people think it too off-topic.
>
>
> James
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20051026/03b06cb5/attachment.bin 


More information about the Nitro-general mailing list