I just set up my rails 3 on Amazon EC2 with apache2 and passenger.
Everything is working great but when I created my first project inside /var/www/html/ror/public/ the project does not show up. I tried mydomain.com/example which is the name of my project and it gives me an index of my rails project that I generated earlier. When I say index I mean a list of all the folders without rendering any html from the views. I guess my question is: how do I redirect the user to mydomain.com/example/app/views/example/index.html.erb
I tried playing around with httpd.conf and 开发者_运维技巧but nothing seems to work out.
Thanks
You are facing problems in deploying the site. Follow this -
Create a virtual host
$ sudo nano /etc/apache2/sites-available/app-name
Change the contents of the virtual host to
<VirtualHost *:80> ServerName A.B.C.D ServerAlias subdomain.abc.com DocumentRoot /var/www/app-name/current/public RackEnv production </VirtualHost>
Enable the new site
$ sudo a2ensite demo-app
Restart Apache
$ sudo /etc/init.d/apache2 restart
Make sure you mention the correct document root.
DocumentRoot /var/www/app-name/current/public
More details - https://docs.google.com/document/d/1Cw-oiE4AYrnbo_b7o593npTPaW8hRhRZERJ_ZETdrB8/edit?hl=en
You need to add RailsBaseURI /ror/public
to your apache config.
Or, symlink:
mkdir /var/rails
mv /var/www/html/ror /var/rails
cd /var/www/html
ln -s /var/www/html/ror/public ror
(shouldn't put Rails app sources in your apache document tree)
and then RailsBaseURI /ror
Your app will be at example.com/ror
精彩评论