配置NGINX以在Rails和Drupal网站上提供Ruby [英] Configuring NGINX to serve Ruby on Rails and Drupal websites

查看:127
本文介绍了配置NGINX以在Rails和Drupal网站上提供Ruby的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试将我的Drupal网站从Bluehost迁移到DigitalOcean时,我遇到了我的nginx设置的困难。



我有一个活着的Ruby on Rails应用程序〜/ Kiji,我想要Drupal一个进入〜/ EAS。



这是我当前的nginx.conf文件(没有配置为我不明白我需要改变什么 - 我已经从此页面

  worker_processes 1 ; 

事件{
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网站
server {
listen 80;
server_name localhost;
passenger_enabled on;
root / home / daniG2k / Kiji / public;

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

#Drupal网站...仍然在这个〜!
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;
}
位置〜\.php $ {
try_files $ uri = 404;
fastcgi_split_path_info ^(。+ \.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
包含fastcgi_params;
}
}
}

再次,Drupal部分直接从DigitalOcean网站,但我不知道我需要编辑/添加到这里才能使其工作。注意,我已经安装了MySQL和php5-fpm,php5-mysql。



任何建议都非常感谢!

解决方案

您链接的网页解释了一切,除了您必须将Drupal根目录更改为

  root / home / daniG2k / EAS; 

请尽可能多地处理该页面。您可以发布另一个确定您不明白的特定行的问题。



通常每个服务器的服务器名称通常不会相同。


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!

解决方案

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.

这篇关于配置NGINX以在Rails和Drupal网站上提供Ruby的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆