Skip to content

Instantly share code, notes, and snippets.

@Eth3rnit3
Created July 7, 2019 20:38
Show Gist options
  • Save Eth3rnit3/ee14f69ce12b17c91aa59b95d601d222 to your computer and use it in GitHub Desktop.
Save Eth3rnit3/ee14f69ce12b17c91aa59b95d601d222 to your computer and use it in GitHub Desktop.
- Install passenger
- Install nginx
- Install nginx-passenger
- Configure nginx-passenger for ruby path
## Nginx conf
`/etc/nginx/site-available/domain.com`
```text
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80 default_server;
root /home/deploy/www/sublime/current/public;
# Add index.php to the list if you are using PHP
index index.html;
server_name 51.91.25.18;
access_log /home/deploy/www/sublime/logs/access.log;
error_log /home/deploy/www/sublime/logs/errors.log;
server_name localhost;
passenger_enabled on;
passenger_app_env production;
location ~* ^.+\.(jpeg|gif|png|jpg|webp) {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
}
location /sidekiq {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
}
location /api {
# Insert your public app path
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /index.html;
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment