Search Type:
Search for:

Language:

Product:
Category:
No categories for selected product

[How to] Erstellen einer einfachen ROR-Applikation auf der Domain?

Article ID: 6237 
Last Review: Jul,13 2009
Author: Elena Deriabina
Last updated by: Elena Deriabina APPLIES TO:
  • Plesk 9.x for Linux/Unix

Lösung

Anhand der unten stehenden Anleitung können Sie eine einfache Ruby on Rails (ROR)-Applikation erstellen, die "Hello World" ausgibt.

1. Aktivieren Sie die ROR-Unterstützung in Parallels Plesk Panel. Verwenden Sie hierzu den Autoinstaller im Control Panel.
Melden Sie sich als admin bei Parallels Plesk Panel an und wechseln Sie zur Seite (Start -> Updates -> Parallels Plesk Panel 9). Aktivieren Sie mit dem entsprechenden Kontrollkästchen die Ruby on Rails-Unterstützung und klicken Sie auf den Button Installieren, um die Installation der ROR-Unterstützung zu starten.

2. Erstellen Sie die Testdomain DOMAIN.TLD.

3. Aktivieren Sie in der Hosting-Konfiguration den SSH-Zugriff, CGI und FastCGI (Domains -> DOMAIN.TLD -> Webhosting-Einstellungen):

Shell access to server with FTP user's credentials [/bin/shell]
CGI support [x]
FastCGI support (required for Ruby on Rails) [x]


Hierbei ist /bin/shell die für den Plesk-Server verfügbare Shell. Eine Liste der System-Shells ist in der Datei /etc/shells gespeichert und kann vom Systemadministrator abgerufen werden:

~# cat /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/rbash
~#

4. Melden Sie sich mit dem Login und Passwort des Domain-FTP-Benutzers via SSH bei der Domain an:

~# ssh FTP.USER@DOMAIN.TLD

-sh-3.2$ ls -l
total 48
drwxr-x--- 5 FTP.USER psaserv 4096 Apr  3 11:27 anon_ftp
drwxr-xr-x 2 root     psaserv 4096 Apr  3 11:27 bin
drwxr-x--- 3 FTP.USER psaserv 4096 Apr  3 11:27 cgi-bin
drwxr-x--- 2 root     psaserv 4096 Apr 10 09:17 conf
drwxr-xr-x 2 root     psaserv 4096 Apr  3 11:27 error_docs
drwxr-x--- 7 FTP.USER psaserv 4096 Apr  3 11:27 httpdocs
drwxr-x--- 7 FTP.USER psaserv 4096 Apr  3 11:27 httpsdocs
drwxr-x--- 2 root     psaserv 4096 Apr  3 11:27 pd
drwx------ 2 FTP.USER root    4096 Apr  3 11:27 private
dr-xr-x--- 7 root     psaserv 4096 Apr  3 11:27 statistics
drwxr-xr-x 2 root     psaserv 4096 Apr  3 11:27 subdomains
drwxr-xr-x 2 root     psaserv 4096 Apr  3 11:27 web_users
-sh-3.2$

5. Wechseln Sie zum Verzeichnis httpdocs:

-sh-3.2$ cd httpdocs

6. Erstellen Sie die Testapplikation "ruby_test_application" im aktuellen Verzeichnis:

-sh-3.2$ rails ruby_test_application

7. Wechseln Sie zum Verzeichnis "ruby_test_application":

-sh-3.2$ cd ruby_test_application

8. Führen Sie den folgenden Befehl aus, um einen neuen Controller namens "Hello" zu erstellen:

-sh-3.2$ ruby script/generate controller Hello index
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/hello
      exists  test/functional/
      create  app/controllers/hello_controller.rb
      create  test/functional/hello_controller_test.rb
      create  app/helpers/hello_helper.rb
      create  app/views/hello/index.rhtml
-sh-3.2$

Sie können dem Testcontroller auch einen anderen Namen zuweisen. Ersetzen Sie hierzu "Hello" durch den gewünschten Namen.

9. Öffnen Sie die Datei ruby_test_application/app/controllers/hello_controller.rb im Dateieditor und ändern Sie ihren Inhalt.
Sie befinden sich momentan im Verzeichnis ruby_test_application, daher sollten Sie zum Öffnen der Datei den folgenden Befehl verwenden:

-sh-3.2$ pwd
/var/www/vhosts/DOMAIN.TLD/httpdocs/ruby_test_application
-sh-3.2$ vim app/controllers/hello_controller.rb

Suchen Sie den folgenden Inhalt:

---
class HelloController < ApplicationController

  def index
  end
end
---


Ersetzen Sie ihn durch den folgenden Inhalt:

---
class HelloController < ApplicationController

  def index
                @message = "Hello World"
  end
end
---


10. Öffnen Sie die Datei ruby_test_application/app/views/hello/index.rhtml im Dateieditor:

-sh-3.2$ pwd
/var/www/vhosts/DOMAIN.TLD/httpdocs/ruby_test_application
-sh-3.2$ vim app/views/hello/index.rhtml

Ändern Sie ihren Inhalt von

---
<h1>Hello#index</h1>
<p>Find me in app/views/hello/index.rhtml</p>
---


in

---
<h1><%= @message %></h1>
---


11. Wechseln Sie zum Verzeichnis httpdocs:

-sh-3.2$ pwd
/var/www/vhosts/DOMAIN.TLD/httpdocs/ruby_test_application
-sh-3.2$ cd ..

12. Benennen Sie das Verzeichnis der Testapplikation um:

-sh-3.2$ mv ruby_test_application ruby_test_application.real

13. Erstellen Sie einen Symbollink:

-sh-3.2$ ln -s ruby_test_application.real/public ruby_test_application

14. Öffnen Sie die Applikation im Webbrowser, um ihre Funktion zu prüfen:

http://DOMAIN.TLD/ruby_test_application/Hello

Die Zeichenfolge "Hello World" sollte angezeigt werden.

Zusätzliche Informationen

Die Installation von Ruby Web-Applikationen auf der Plesk-Domain ist im Parallels Plesk Panel 9 Administratorhandbuch dokumentiert.


Subscription for changes to this article Subscription for changes to this article

Please provide feedback on this article

Did this article help you solve your issue?
Yes
No
Partially
I do not know yet
 
Strongly Agree   Strongly Disagree
  9 8 7 6 5 4 3 2 1
The article is easy to understand
The article is accurate
Additional Comments:
*Please provide us with your email address in case we need to contact you.
* - required fields
 
 
 
 
 
 
For Home
For Business
For Hosters
For SaaS
For Developers
 
Desktop Virtualization
- Parallels Desktop Switch to Mac Edition
- Parallels Desktop for Mac
- Parallels Desktop 4 for Windows & Linux
- Parallels Workstation Extreme
- Parallels Solution for Windows 7
Server Virtualization
- Parallels Server for Mac
- Parallels Server 4 Bare Metal
- Parallels Virtuozzo Containers
Automation
- Parallels Operations Automation
- Parallels Business Automation
- Parallels Virtual Automation
- Parallels Plesk Panel Suite
More Products