Welcome! Log In Create A New Profile

Advanced

Configuring NGINX to serve Ruby on Rails and Drupal websites

Posted by DaniG2k 
Configuring NGINX to serve Ruby on Rails and Drupal websites
July 27, 2014 08:36AM
As I try to migrate my Drupal website from Bluehost to DigitalOcean, I am encountering difficulties with my Nginx setup.

I have a live Ruby on Rails app living in ~/Kiji and I'd like for the Drupal one to go into ~/asia-gazette.

Here is my current nginx.conf file (which isn't configured properly as I do not understand exactly what I need to change). Someone suggested I do not need multiple server block but rather multiple location blocks in the same server, which makes sense but I do not know how to configure it if that's the case (I've taken the setup from a tutorial on DigitalOcean). Any help with this is much appreciated!


worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}

http {

passenger_root /home/dani/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.48;
passenger_ruby /home/dani/.rvm/gems/ruby-2.1.2/wrappers/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;

## Ruby on Rails app
server {
listen 80;
server_name localhost;
passenger_enabled on;
root /home/dani/Kiji/public;

location ~ ^/(assets)/ {
expires max;
add_header Cache-Control public;
gzip_static on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

## Drupal app
server {
listen 80;

root /home/dani/asia-gazette;
index index.php;

server_name localhost/asia-gazette;

location / {
try_files $uri $uri/ =404;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/dani/asia-gazette;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
}



Edited 2 time(s). Last edit at 07/27/2014 08:38AM by DaniG2k.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 301
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready