What is the difference in the setup/deployment process of Django, RoR and PHP with Apache

时间:2015-07-28 22:39:40

标签: php python ruby-on-rails django apache

I have some general questions regarding the difference in the setup process of Django, RoR and PHP with Apache. My understanding is the following, is my understanding correct? are those the best practices for deploying Django and RoR with Apache?

PHP:

Apache has native interpreter for PHP, therefore, when Apache receives a http request that invoke a .php file it will run the PHP code directly and return the result html to the requester. To set up PHP with Apache, we simply need to specify the PHP directory path in the Apache config file

RoR:

Apache does not have native interpreter for Ruby; there must be a separate Rails webserver such as Thin or Unicorn running on a port other than 80. This webserver can invoke Ruby interpreter to process the Ruby programs. Apache's roll in this process is to redirect the http request on port 80 to the port where the rails webserver is listening. The following lines in the Apache configuration file will do the redirecting: (assuming the Rails server is running on port 3000).

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
<VirtualHost *:80>
    ServerName <xxx>
    DocumentRoot "D:/RailsFolder"
    ProxyPass / http://<xxx>.com:3000/
    ProxyPassReverse / http://<xxx>.com:3000/
    ProxyPreserveHost On
</VirtualHost>

Is this the ideal way to deploy RoR with Apache, will there be performance issues due to the overhead of redirecting?

Django:

This is my least familiar topic. My understanding is that there is no native interpreter for Python in Apache, but we can install "mod_wsgi" module to Apache, this will enable Apache to interpret Python code directly. After the installation of the "mod_wsgi" module, I can use Apache with Django application the same way as PHP; which is directly specify the Django directory path in the Apache config file, and every time a http request comes in Apache will invoke python interpreter to process the python program. Is this the right understanding?

0 个答案:

没有答案