Running foreman under passenger with nginx

Hello All,

Has anyone got foreman UI running under passenger and nginx?. The rack
application doesnt startup with the following config

server {
listen 7000;
server_name foreman;
root /usr/share/foreman/public;
passenger_enabled on;
passenger_use_global_queue on;
rails_spawn_method smart;
rails_env production;
passenger_min_instances 2;
charset utf-8;

access_log logs/foreman/foreman.log;
error_log  logs/foreman/foreman_error.log;

}

Can anyone point me to the configuration?

I have got foreman running under apache + passenger fine.

Regards,
Kevin

> Hello All,
>
> Has anyone got foreman UI running under passenger and nginx?. The rack
> application doesnt startup with the following config
>
> server {
> listen 7000;
> server_name foreman;
> root /usr/share/foreman/public;
> passenger_enabled on;
> passenger_use_global_queue on;
> rails_spawn_method smart;
> rails_env production;
> passenger_min_instances 2;
> charset utf-8;
>
> access_log logs/foreman/foreman.log;
> error_log logs/foreman/foreman_error.log;
> }
>
what is the error that you get? are you sure you are running it with the
correct user?

Ohad

··· On Fri, 2011-06-17 at 14:13 -0700, linuxbsdfreak wrote: > > Can anyone point me to the configuration? > > I have got foreman running under apache + passenger fine. > > Regards, > Kevin >

Hi,

I get the following error in nginx logs:

2011/06/18 13:25:00 [error] 22670#0: *1 directory index of "/usr/share/
foreman/public/" is forbidden, client: <ipaddress>, server: foreman,
request: "GET / HTTP/1.1", host: "foreman:7000"

When i enable autoindex on; in the below configuration, i only get a
directory listing on /usr/share/foreman/ dir. Nginx is running as user
nginx. The permission on the /usr/share/foreman dir is with user
foreman.

Regards,
Kevin

··· On Jun 19, 9:05 am, Ohad Levy wrote: > On Fri, 2011-06-17 at 14:13 -0700, linuxbsdfreak wrote: > > Hello All, > > > Has anyone got foreman UI running under passenger and nginx?. The rack > > application doesnt startup with the following config > > > server { > > listen 7000; > > server_name foreman; > > root /usr/share/foreman/public; > > passenger_enabled on; > > passenger_use_global_queue on; > > rails_spawn_method smart; > > rails_env production; > > passenger_min_instances 2; > > charset utf-8; > > > access_log logs/foreman/foreman.log; > > error_log logs/foreman/foreman_error.log; > > } > > what is the error that you get? are you sure you are running it with the > correct user? > > Ohad > > > > > > > > > > > Can anyone point me to the configuration? > > > I have got foreman running under apache + passenger fine. > > > Regards, > > Kevin

> Has there been any traction on this issue? I'm trying to get a nightly
> build to work with Nginx + Passenger with the same results. It seems to
> work fine in Apache.
>
> Thats pretty odd, I have little experience with nginx, but are you sure
its configured correctly?

Ohad

··· On Mon, Jun 4, 2012 at 9:54 AM, Ryan Bourgeois wrote:

On Sunday, June 19, 2011 10:59:58 AM UTC-5, linuxbsdfreak wrote:

Hi,

I get the following error in nginx logs:

2011/06/18 13:25:00 [error] 22670#0: *1 directory index of “/usr/share/
foreman/public/” is forbidden, client: , server: foreman,
request: “GET / HTTP/1.1”, host: “foreman:7000”

When i enable autoindex on; in the below configuration, i only get a
directory listing on /usr/share/foreman/ dir. Nginx is running as user
nginx. The permission on the /usr/share/foreman dir is with user
foreman.

Regards,
Kevin

On Jun 19, 9:05 am, Ohad Levy ohadl...@gmail.com wrote:

On Fri, 2011-06-17 at 14:13 -0700, linuxbsdfreak wrote:

Hello All,

Has anyone got foreman UI running under passenger and nginx?. The
rack

application doesnt startup with the following config

server {
listen 7000;
server_name foreman;
root /usr/share/foreman/public;
passenger_enabled on;
passenger_use_global_queue on;
rails_spawn_method smart;
rails_env production;
passenger_min_instances 2;
charset utf-8;

access_log logs/foreman/foreman.log;
error_log  logs/foreman/foreman_error.**log;

}

what is the error that you get? are you sure you are running it with
the
correct user?

Ohad

Can anyone point me to the configuration?

I have got foreman running under apache + passenger fine.

Regards,
Kevin


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/foreman-users/-/cCdEGKAAA5gJ.

To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.

Yes, I can drop an example config.ru in place and it just works.

··· On Mon, Jun 4, 2012 at 2:02 AM, Ohad Levy wrote:

On Mon, Jun 4, 2012 at 9:54 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

Has there been any traction on this issue? I’m trying to get a nightly
build to work with Nginx + Passenger with the same results. It seems to
work fine in Apache.

Thats pretty odd, I have little experience with nginx, but are you sure
its configured correctly?

Actually, I just figured it out. The above statement wasn't entirely true.
I created a test config.ru and an empty public under /var/www to test my
Foreman nnginx config. I changed the vhost to point the root to /var/www
instead of /usr/share/foreman and it worked. When I pointed the root back
at /usr/share/foreman and copied my example config.ru to /usr/share/foreman
(and left the rest of that directory alone) it no longer worked.

I then overwrote the public symlink with the actual directory (cp
-rf /var/lib/foreman/public /usr/share/foreman/public) and did the same
with the tmp directory and things work as normal.

It appears that Passenger on Nginx does not like those two directories to
be symlinks. My quick googling has not yet turned up a solution to this
other than not using symlinks for your root directory.

··· On Mon, Jun 4, 2012 at 2:03 AM, Ryan Bourgeois wrote:

On Mon, Jun 4, 2012 at 2:02 AM, Ohad Levy ohadlevy@gmail.com wrote:

On Mon, Jun 4, 2012 at 9:54 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

Has there been any traction on this issue? I’m trying to get a nightly
build to work with Nginx + Passenger with the same results. It seems to
work fine in Apache.

Thats pretty odd, I have little experience with nginx, but are you sure
its configured correctly?

Yes, I can drop an example config.ru in place and it just works.

I got it working with some minimal hackery. Since I'm deploying this using
Puppet and the nightly builds I'm doing my best to avoid messing with
anything a package deploys, and this hack is minimal enough to satisfy me.

Anywho, I fixed it by symlinking the config.ru under /var/lib/foreman (ln
-s /usr/share/foreman/config.ru /var/lib/foreman/config.ru).

This works because Passenger resolves the real path of the root and then
tries to find config.ru relative to that. So it's looking for a
config.ruat the above location.

Hopefully others who run across this issue will also run across this post.
I'd been banging my head against the wall most of the night to fix it!

··· On Mon, Jun 4, 2012 at 2:14 AM, Ryan Bourgeois wrote:

On Mon, Jun 4, 2012 at 2:03 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

On Mon, Jun 4, 2012 at 2:02 AM, Ohad Levy ohadlevy@gmail.com wrote:

On Mon, Jun 4, 2012 at 9:54 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

Has there been any traction on this issue? I’m trying to get a nightly
build to work with Nginx + Passenger with the same results. It seems to
work fine in Apache.

Thats pretty odd, I have little experience with nginx, but are you sure
its configured correctly?

Yes, I can drop an example config.ru in place and it just works.

Actually, I just figured it out. The above statement wasn’t entirely true.
I created a test config.ru and an empty public under /var/www to test my
Foreman nnginx config. I changed the vhost to point the root to /var/www
instead of /usr/share/foreman and it worked. When I pointed the root
back at /usr/share/foreman and copied my example config.ru to
/usr/share/foreman (and left the rest of that directory alone) it no longer
worked.

I then overwrote the public symlink with the actual directory (cp
-rf /var/lib/foreman/public /usr/share/foreman/public) and did the same
with the tmp directory and things work as normal.

It appears that Passenger on Nginx does not like those two directories to
be symlinks. My quick googling has not yet turned up a solution to this
other than not using symlinks for your root directory.

>
>
>>
>>
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>>> Has there been any traction on this issue? I'm trying to get a nightly
>>>>> build to work with Nginx + Passenger with the same results. It seems to
>>>>> work fine in Apache.
>>>>>
>>>>> Thats pretty odd, I have little experience with nginx, but are you
>>>> sure its configured correctly?
>>>>
>>>>
>>> Yes, I can drop an example config.ru in place and it just works.
>>>
>>
>> Actually, I just figured it out. The above statement wasn't entirely
>> true. I created a test config.ru and an empty public under /var/www to
>> test my Foreman nnginx config. I changed the vhost to point the root to
>> /var/www instead of /usr/share/foreman and it worked. When I pointed
>> the root back at /usr/share/foreman and copied my example config.ru to
>> /usr/share/foreman (and left the rest of that directory alone) it no longer
>> worked.
>>
>> I then overwrote the public symlink with the actual directory (cp
>> -rf /var/lib/foreman/public /usr/share/foreman/public) and did the same
>> with the tmp directory and things work as normal.
>>
>> It appears that Passenger on Nginx does not like those two directories to
>> be symlinks. My quick googling has not yet turned up a solution to this
>> other than not using symlinks for your root directory.
>>
>
> I got it working with some minimal hackery. Since I'm deploying this using
> Puppet and the nightly builds I'm doing my best to avoid messing with
> anything a package deploys, and this hack is minimal enough to satisfy me.
>
> Anywho, I fixed it by symlinking the config.ru under /var/lib/foreman (ln
> -s /usr/share/foreman/config.ru /var/lib/foreman/config.ru).
>
> This works because Passenger resolves the real path of the root and then
> tries to find config.ru relative to that. So it's looking for a config.ruat the above location.
>
> Hopefully others who run across this issue will also run across this post.
> I'd been banging my head against the wall most of the night to fix it!
>

Thanks Ryan!! any chance you want to patch up the installer[1]
to reflect this change?

Ohad

[1] https://github.com/theforeman/foreman-installer

··· On Mon, Jun 4, 2012 at 10:25 AM, Ryan Bourgeois wrote: > On Mon, Jun 4, 2012 at 2:14 AM, Ryan Bourgeois wrote: >> On Mon, Jun 4, 2012 at 2:03 AM, Ryan Bourgeois wrote: >>> On Mon, Jun 4, 2012 at 2:02 AM, Ohad Levy wrote: >>>> On Mon, Jun 4, 2012 at 9:54 AM, Ryan Bourgeois wrote:


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To post to this group, send email to foreman-users@googlegroups.com.
To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.

Sure, I'll see if I can't get something worked up and tested tonight.

-Ryan

··· On Mon, Jun 4, 2012 at 2:49 AM, Ohad Levy wrote:

On Mon, Jun 4, 2012 at 10:25 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

On Mon, Jun 4, 2012 at 2:14 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

On Mon, Jun 4, 2012 at 2:03 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

On Mon, Jun 4, 2012 at 2:02 AM, Ohad Levy ohadlevy@gmail.com wrote:

On Mon, Jun 4, 2012 at 9:54 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

Has there been any traction on this issue? I’m trying to get a
nightly build to work with Nginx + Passenger with the same results. It
seems to work fine in Apache.

Thats pretty odd, I have little experience with nginx, but are you
sure its configured correctly?

Yes, I can drop an example config.ru in place and it just works.

Actually, I just figured it out. The above statement wasn’t entirely
true. I created a test config.ru and an empty public under /var/www to
test my Foreman nnginx config. I changed the vhost to point the root to
/var/www instead of /usr/share/foreman and it worked. When I pointed
the root back at /usr/share/foreman and copied my example config.ru to
/usr/share/foreman (and left the rest of that directory alone) it no longer
worked.

I then overwrote the public symlink with the actual directory (cp
-rf /var/lib/foreman/public /usr/share/foreman/public) and did the same
with the tmp directory and things work as normal.

It appears that Passenger on Nginx does not like those two directories
to be symlinks. My quick googling has not yet turned up a solution to this
other than not using symlinks for your root directory.

I got it working with some minimal hackery. Since I’m deploying this
using Puppet and the nightly builds I’m doing my best to avoid messing with
anything a package deploys, and this hack is minimal enough to satisfy me.

Anywho, I fixed it by symlinking the config.ru under /var/lib/foreman
(ln -s /usr/share/foreman/config.ru /var/lib/foreman/config.ru).

This works because Passenger resolves the real path of the root and then
tries to find config.ru relative to that. So it’s looking for a config.ruat the above location.

Hopefully others who run across this issue will also run across this
post. I’d been banging my head against the wall most of the night to fix it!

Thanks Ryan!! any chance you want to patch up the installer[1]
to reflect this change?

Ohad

[1] https://github.com/theforeman/foreman-installer

The foreman-installer uses Apache so it's a non-issue there. It also looks
like it handles the link. Since I'm rolling my own set of manifests around
the nightly build it behaves differently.

-Ryan

··· On Mon, Jun 4, 2012 at 1:06 PM, Ryan Bourgeois wrote:

On Mon, Jun 4, 2012 at 2:49 AM, Ohad Levy ohadlevy@gmail.com wrote:

On Mon, Jun 4, 2012 at 10:25 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

On Mon, Jun 4, 2012 at 2:14 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

On Mon, Jun 4, 2012 at 2:03 AM, Ryan Bourgeois bluedragonx@gmail.comwrote:

On Mon, Jun 4, 2012 at 2:02 AM, Ohad Levy ohadlevy@gmail.com wrote:

On Mon, Jun 4, 2012 at 9:54 AM, Ryan Bourgeois <bluedragonx@gmail.com >>>>>> > wrote:

Has there been any traction on this issue? I’m trying to get a
nightly build to work with Nginx + Passenger with the same results. It
seems to work fine in Apache.

Thats pretty odd, I have little experience with nginx, but are you
sure its configured correctly?

Yes, I can drop an example config.ru in place and it just works.

Actually, I just figured it out. The above statement wasn’t entirely
true. I created a test config.ru and an empty public under /var/www to
test my Foreman nnginx config. I changed the vhost to point the root to
/var/www instead of /usr/share/foreman and it worked. When I pointed
the root back at /usr/share/foreman and copied my example config.ru to
/usr/share/foreman (and left the rest of that directory alone) it no longer
worked.

I then overwrote the public symlink with the actual directory (cp
-rf /var/lib/foreman/public /usr/share/foreman/public) and did the same
with the tmp directory and things work as normal.

It appears that Passenger on Nginx does not like those two directories
to be symlinks. My quick googling has not yet turned up a solution to this
other than not using symlinks for your root directory.

I got it working with some minimal hackery. Since I’m deploying this
using Puppet and the nightly builds I’m doing my best to avoid messing with
anything a package deploys, and this hack is minimal enough to satisfy me.

Anywho, I fixed it by symlinking the config.ru under /var/lib/foreman
(ln -s /usr/share/foreman/config.ru /var/lib/foreman/config.ru).

This works because Passenger resolves the real path of the root and then
tries to find config.ru relative to that. So it’s looking for a
config.ru at the above location.

Hopefully others who run across this issue will also run across this
post. I’d been banging my head against the wall most of the night to fix it!

Thanks Ryan!! any chance you want to patch up the installer[1]
to reflect this change?

Ohad

[1] https://github.com/theforeman/foreman-installer

Sure, I’ll see if I can’t get something worked up and tested tonight.

-Ryan