Var/www

Hello,

I removed apache2 after installing nginx with passenger. If I browse
http://127.0.0.1, I get the nginx page. However, if I browse
http://localhost, I get the old apache index web page in var/www.

Does anyone please know how to rectify this?

Kind regards

What’s your config look like? And did you flush the browsers cache?

Rob S. wrote:

What’s your config look like? And did you flush the browsers cache?

Hello Rob,

in between posting the question and your lightening reply, I found the
problem - nginx put the files into a sub-folder of var/www, so I just
moved them - need an embarrassed emoicon here… :slight_smile:

However, I have tried to get a local rails app working (it does on
web-brick), but without success - can’t get a reply on
localhost/testdir/testrhtml say. Could you please tell me if this looks
right in the conf file?

server {
listen 80;
server_name localhost;
root /home/me/sites/my_app/public; # <— be sure to point to
‘public’!
passenger_enabled on;
}

Kind regards

Paul,
This is an example of trimmed down passenger setup i am using with nginx

http {
passenger stuff
passenger_root /opt/ree/lib/ruby/gems/1.8/gems/passenger-2.2.7;
passenger_ruby /opt/ree/bin/ruby;

server {
listen 80;
server_name domain.com;

      access_log      /var/log/nginx/domain.com.access_log main;
      error_log       /var/log/nginx/domain.com.error_log info;

      root /var/www/domain.com/public;

      passenger_enabled on;

      location ~* ^.+\.(jpg|jpeg|gif|png)$ {
              access_log   off;
              expires      30d;
      }

}
}

V/r,
Rob S.

Rob S. wrote:

Paul,
This is an example of trimmed down passenger setup i am using with nginx
V/r,
Rob S.

Hello Rob,

Thanks for your answer - over in Europe, so sound asleep when you
replied!

I have had a look around the configurations questions that I can find
for nginx, but nothing seems to answer the problem I have.

The computer that I am using for trials has had apache2 installed on it,
ruby, rails etc. as well. The idea is that I would like to create an
environment similar to the web server (running Ubuntu 8.10 server with
eBox), so that I know what to do with that when the installation on the
laptop is successful. I am looking to remove apache2 from the web server
and replace it with nginx, so
I did that on the laptop first.

A quick side question - do you know whether I can run nginx as well as
apache2 on the server? nginx would handle all ports except eBox
administration. Just a thought - not important really, but I am not sure
whether eBox needs apache2.

The web server will have two domains to host from the same fixed IP, and
needs SSL for one of them.

The trial computer now has all apache2 files taken off, and nginx is now
the web server. One of the web sites will be a rails site.

The rails site on the trial computer is at /home/paul/sites/my_app/, and
has all the usual sub-directories created by rails. I don’t know where
to put the rails files on the web server at present.

For the moment, the only hostname on the laptop is localhost.

*The server uses squirrelmail with postfix. I have it set up currently
for IMAP. This I do not have on the laptop, but it is important for the
web- server!

There seem to be 4 files with configuration for gninx it them:

/var/nginx/conf/nginx.conf (this one I changed - probably the wrong
one!)
/etc/nginx/nginx.conf (no changed made since installation)
/etc/nginx/sites-available/default (no changed made since installation)
/etc/nginx/sites-enabled/default (no changed made since installation)

(virtual host, ssl and php are # out at present - I take it that is
default)

So, please could you tell me which file should be edit, and what to put
in to achieve all/some of this?

Thanks in advance for your time!

Kind regards
Paul

Rob S. wrote:

Hi Paul,
A lot of help here…
V/r,
Rob S.

Well, a Happy New Year to you, and thanks very much for the help. I will
browse through the links you gave me, and hopefully get the
configuration correct - should keep me busy…

Kind regards,
Paul

Hi Paul,

A quick side question - do you know whether I can run nginx as well as
apache2 on the server? nginx would handle all ports except eBox
administration. Just a thought - not important really, but I am not sure
whether eBox needs apache2.
You can have apache listen on a separate port then apache2 and either
access apache directly via the alternate port or you can have nginx
proxy to the apache port so you can use standard access.

The web server will have two domains to host from the same fixed IP, and
needs SSL for one of them.
You can have multiple servers on 1 ip address easily.
Module ngx_http_core_module there are limitations
with SSL and ip addresses SNI
Server Name Indication - Wikipedia is needed if you
want multiple hosts with SSL.

The trial computer now has all apache2 files taken off, and nginx is now
the web server. One of the web sites will be a rails site.

The rails site on the trial computer is at /home/paul/sites/my_app/, and
has all the usual sub-directories created by rails. I don’t know where
to put the rails files on the web server at present.
You can put them anywhere you want on the server as long as you point it
to the location of your rails app.
I personally use a structure like
/var/www/domain.com/ to hold the website. and then just put the roots to
the proper location. if its a standard website i normally create a
htdocs folder for all the web files. If its rails app i just use the
rails structure and put everything in public etc etc.

There seem to be 4 files with configuration for gninx it them:

/var/nginx/conf/nginx.conf (this one I changed - probably the wrong
one!)
/etc/nginx/nginx.conf (no changed made since installation)
/etc/nginx/sites-available/default (no changed made since installation)
/etc/nginx/sites-enabled/default (no changed made since installation)
Using Debain 5.0 the config files are /etc/nginx/nginx.conf and probably
the sites-availabe and sites-enabled ones. I am sure Ubuntu has the same
structure.

(virtual host, ssl and php are # out at present - I take it that is
default)
http://wiki.nginx.org is good resource for finding example configuration
files and all the modules.

V/r,
Rob S.