Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Configuring NGINX to serve Ruby on Rails and Drupal websites

$
0
0
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;
}
}
}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>