Setting up Nginx + Passenger » History » Version 3
Kevin Cormier, 01/11/2013 12:54 PM
1 | 1 | Rytis Sileika | h1. Setting up Nginx + Passenger |
---|---|---|---|
2 | |||
3 | Passenger packages/repos are available at http://passenger.stealthymonkeys.com/ |
||
4 | |||
5 | |||
6 | Install packages |
||
7 | |||
8 | <pre> |
||
9 | # yum install -y nginx-passenger |
||
10 | </pre> |
||
11 | |||
12 | Create self signed certificate |
||
13 | |||
14 | <pre> |
||
15 | # cd /etc/nginx/ |
||
16 | # openssl genrsa -des3 -out server.key 1024 |
||
17 | # openssl req -new -key server.key -out server.csr |
||
18 | # cp server.key server.key.org |
||
19 | # openssl rsa -in server.key.org -out server.key |
||
20 | # openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt |
||
21 | </pre> |
||
22 | |||
23 | Make a local copy of the apps `public` directory (local to rails, as nginx/passenger doesn't seem to like symbolic links) |
||
24 | |||
25 | <pre> |
||
26 | # cd /usr/share/foreman |
||
27 | # rm public |
||
28 | # cp -a /var/lib/foreman/public . |
||
29 | </pre> |
||
30 | |||
31 | Add to `/etc/nginx/nginx.conf`: |
||
32 | |||
33 | <pre> |
||
34 | env PATH; |
||
35 | </pre> |
||
36 | |||
37 | Create foreman application config file `/etc/nginx/conf.d/foreman.conf`: |
||
38 | |||
39 | <pre> |
||
40 | server { |
||
41 | listen 443; |
||
42 | server_name _; |
||
43 | ssl on; |
||
44 | ssl_certificate /etc/nginx/server.crt; |
||
45 | ssl_certificate_key /etc/nginx/server.key; |
||
46 | access_log /var/log/nginx/foreman_access.log; |
||
47 | error_log /var/log/nginx/foreman_error.log debug; |
||
48 | root /usr/share/foreman/public; |
||
49 | passenger_enabled on; |
||
50 | #location / { |
||
51 | #} |
||
52 | } |
||
53 | </pre> |