30291

Configuring NGINX to serve Ruby on Rails and Drupal websites

Question:

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 ~/EAS.

Here is my current nginx.conf file (which isn't configured as I do not understand exactly what I need to change - I have taken the setup from <a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04" rel="nofollow">this page</a>)

worker_processes 1; events { worker_connections 1024; } http { passenger_root /home/daniG2k/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.45; passenger_ruby /home/daniG2k/.rvm/gems/ruby-2.1.2/wrappers/ruby; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; # Ruby on Rails website server { listen 80; server_name localhost; passenger_enabled on; root /home/daniG2k/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 website...still working on this~!! server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.php index.html index.htm; server_name localhost; location / { try_files $uri $uri/ =404; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } 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; } } }

Again, the Drupal part was taken directly from the DigitalOcean website but I am not sure what I need to edit/add here to get it to work. Note, I have already installed MySQL and php5-fpm, php5-mysql.

Any advice is much appreciated!

Answer1:

The web page you linked explains everything except that you have to change the Drupal root directory to

root /home/daniG2k/EAS;

Please work through that page as much as you can. You could then post another question identifying the specific line you do not understand.

You wouldn't normally have the same server name for each server.

Recommend

  • Directory listing instead of Rails site after Passenger/REE upgrade
  • New rails installation with error when entering url
  • Do not require authentication for OPTIONS requests
  • ClickOnce is not working in Internet Explorer 9
  • In Rails, what could cause a user to have another user's session?
  • Grails: how do I set up a response wrapper in a Grails filter?
  • Using nodejs server with request package and function pipe()?
  • HTML 5 video (ogv) and MIME types
  • PHP - sending email with attachment does not show message content
  • LyX — Title, Abstract, Keywords Missing When Using Elsevier Class in View
  • Recursion in ASP.NET Core Razor views
  • Bootstrap navbar stays expanded on route change
  • How to have a website splash screen (web app)
  • Angular Ui-router can't access $stateParams inside my controller
  • Google App Engine - SSL InsecurePlatformWarning
  • Error Processing Request: Mage registry key “_singleton/inchoo_notes/feed_updates” already exists
  • Convert symmetric matrix between packed and full storage?
  • Grunt watch Running “watch” task Waiting
  • QueryString id parameter not being used
  • Open an application in a space using applescripts
  • Using SWIG with a build system [closed]
  • Where can I get Microsoft.DirectX.dll?
  • py4j.protocol.Py4JJavaError when selecting nested column in dataframe using select statetment
  • Couchbase: Connection refused
  • How can I extend PHP DOMElement?
  • Installing Perl6 and Panda on Ubuntu 15.10. Problems with bootstrap.pl
  • Can my PDF ping my server when it is opened?
  • Suqueries in select clause with JPA
  • Using Laravel 5.4 pusher
  • Security issues with PHP's Readfile method
  • Oledb connection string for excel files
  • Android full screen on only one activity?
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • Counter field in MS Access, how to generate?
  • Accessing IRQ description array within a module and displaying action names
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Arrays break string types in Julia
  • Buffer size for converting unsigned long to string
  • Hits per day in Google Big Query
  • How to get Windows thread pool to call class member function?