簡體   English   中英

配置NGINX以服務Ruby on Rails和Drupal網站

[英]Configuring NGINX to serve Ruby on Rails and Drupal websites

當我嘗試將Drupal網站從Bluehost遷移到DigitalOcean時,我的nginx設置遇到了困難。

我在〜/ Kiji中有一個實時的Ruby on Rails應用程序,我想讓Drupal進入〜/ EAS。

這是我當前的nginx.conf文件(未配置,因為我不完全了解我需要更改的內容-我已從此頁面進行設置)

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

同樣,Drupal部分直接來自DigitalOcean網站,但是我不確定我需要在此處進行編輯/添加以使其正常工作。 注意,我已經安裝了MySQL和php5-fpm,php5-mysql。

任何建議深表感謝!

鏈接的網頁說明了所有內容,除了必須將Drupal根目錄更改為

root /home/daniG2k/EAS;

請盡可能多地瀏覽該頁面。 然后,您可以發布另一個問題,以標識您不理解的特定行。

通常,每個服務器都不會具有相同的服務器名稱。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM