问题
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 this page)
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!
回答1:
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.
来源:https://stackoverflow.com/questions/24959702/configuring-nginx-to-serve-ruby-on-rails-and-drupal-websites