In the end of the apache2.conf i added :
LoadModule passenger_module /home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11
PassengerRuby /home/rusik/.rvm/wrappers/ruby-1.9.2-p290/ruby
ServerName localhost
<VirtualHost *:80>
ServerName sample.app
DocumentRoot /home/rusik/work/ruby/sample_app/public
</VirtualHost>
So , when i restarted apache
sudo apachectl restart
I got default apache page ,not rails project default page ,why ?
The default file in /etc/apache2/sites-enabled/000-default , where are default virtual hosts i didn't change .
Have you tried put
<Directory /home/rusik/work/ruby/sample_app/public>
AllowOverride none
Options -MultiViews
</Directory>
within and restart the server?
Also add... Options FollowSymLinks
<Directory ... >
...
Options FollowSymLinks
</Directory>
Related
I can't get passenger to work with apache24 on freebsd 10.1
If I place the virtualhost below into my httpd.conf not only does a request for the virtualhost return 403 forbidden but also the server's hostname documentroot which is just index.html file without rails returns 403 forbidden also the httpd-error.log only says client denied by server configuration.
I assume passenger is failing to rewrite the requests from /public to /app/views/index.html.erb because I didn't put any html files in
/public Already installed mod_fastcgi but responses are still 403 forbidden
This is the tail of my httpd.conf
LoadModule passenger_module /usr/local/lib/ruby/gems/2.1/gems/passenger-5.0.18/buildout/apache2/mod_passenger.so
LoadModule fastcgi_module libexec/apache24/mod_fastcgi.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/lib/ruby/gems/2.1/gems/passenger-5.0.18
PassengerDefaultRuby /usr/local/bin/ruby21
</IfModule>
# Virtual hosts
<VirtualHost *:80>
ServerName www.mydomain.com
DocumentRoot /usr/home/myusername/websites/myrailsappname/public
<Directory /usr/home/myusername/websites/myrailsappname/public>
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Include etc/apache24/Includes/*.conf
Apache 2.4 has different allow/deny rules:
http://httpd.apache.org/docs/2.4/upgrading.html#run-time
You will want to update your rule:
<Directory /usr/home/myusername/websites/myrailsappname/public>
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
to something like:
<Directory /usr/home/myusername/websites/myrailsappname/public>
AllowOverride all
Options -MultiViews
require all granted
</Directory>
I've been trying for days to get a rails app to run under Passenger on Bluehost, but with no luck. Going to my subdomain where I'm hoping this will run, I'm only getting a directory listing with cgi-bin and public subdirectories. No execution of the rails app.
httpd.conf includes:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.1/gems/passenger-5.0.6/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.2.1/gems/passenger-5.0.6
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.1/wrappers/ruby
</IfModule>
and
<VirtualHost 162.144.138.43:80>
ServerName secure.xxxxx.com
ServerAlias www.secure.xxxxx.com
DocumentRoot /home/diamoou1/public_html/securefinance
ServerAdmin webmaster#secure.xxxxx.com
UseCanonicalName Off
CustomLog /usr/local/apache/domlogs/secure.xxxxx.com combined
CustomLog /usr/local/apache/domlogs/secure.xxxxx.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
## User diamoou1 # Needed for Cpanel::ApacheConf
UserDir enabled diamoou1
<IfModule mod_suphp.c>
suPHP_UserGroup diamoou1 diamoou1
</IfModule>
<IfModule !mod_disable_suexec.c>
<IfModule !mod_ruid2.c>
SuexecUserGroup diamoou1 diamoou1
</IfModule>
</IfModule>
<IfModule mod_ruid2.c>
RUidGid diamoou1 diamoou1
</IfModule>
ScriptAlias /cgi-bin/ /home/diamoou1/public_html/securefinance/cgi-bin/
<Directory /home/diamoou1/public_html/securefinance>
Options -MultiViews
AllowOverride All
</Directory>
</VirtualHost>
In /home/diamoou1/public_html/securefinance/public I have the .htaccess file:
<IfModule mod_passenger.c>
Allow from all
Order Deny,Allow
Options +FollowSymLinks -SymLinksIfOwnerMatch -MultiViews
PassengerResolveSymlinksInDocumentRoot on
#Set this to whatever environment you'll be running in
RailsEnv production
RackBaseURI /
SetEnv GEM_HOME /home/diamoou1/ruby/gems
</IfModule>
Temporarily putting a bad line in the .htaccess file will give the expected error in the log, so apparently apache is reading the .htaccess file.
I suspect the problem might be in RackBaseURI. I installed Passenger as root. RackBaseURI resolves to /root and there is a /root/public_html directory, although apache is serving up the /home/diamoou1/public_html/securefinance directory (where the rails app actually resides). I don't know how to change that variable or it that's really the problem. PassengerBaseURI is the same.
What do I do to fix this?????
This may help you : https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#_tutorial_example_writing_and_deploying_a_hello_world_rack_application
Here is the example configuration provided by Phusion Passenger :
<VirtualHost *:80>
ServerName www.rackexample.com
DocumentRoot /webapps/rack_example/public
<Directory /webapps/rack_example/public>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
DocumentRoot and Directory should point to the public folder of your rails application not the root.
You should change :
...
DocumentRoot /home/diamoou1/public_html/securefinance
...
<Directory /home/diamoou1/public_html/securefinance>
...
to :
...
DocumentRoot /home/diamoou1/public_html/securefinance/public
...
<Directory /home/diamoou1/public_html/securefinance/public>
...
I have working Rails app on sub-uri redmine.example.org/redmine and I want it on redmine.example.org
/var/www/work/redmine.src is approot
/var/www/work/redmine is symlink to /var/www/work/redmine.src/public
<VirtualHost *:80>
DocumentRoot /var/www/work
ServerName redmine.example.org
ErrorLog /var/log/apache2/redmine-error_log
CustomLog /var/log/apache2/redmine-access_log combined
<Directory /var/www/work/redmine>
AllowOverride all
Options -MultiViews
Order allow,deny
allow from all
</Directory>
RackBaseURI /redmine
<Directory /var/www/work/redmine.src>
Options -MultiViews
Order allow,deny
allow from all
</Directory>
</VirtualHost>
I tried many combination and googled hours, but nothing works.
How should I change this config to deploy redmine on subdomain root?
Thanks in advance.
Well, it was easier, than I supposed.
When I read the manual again and again I found solution:
link to manual
Now my config file looks like this:
<VirtualHost *:80>
DocumentRoot /var/www/work/redmine.src/public
ServerName redmine.example.org
<Directory /var/www/work/redmine.src/public>
AllowOverride all
Options -MultiViews
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Another way to deploy sub-uri app, might work for you too:
<VirtualHost *:80>
ProxyPass /sub_uri/ http://localhost:8000/sub_uri/
DocumentRoot /main_app/public
<Directory /main_app/public>
...
</Directory>
</VirtualHost>
<VirtualHost *:8000>
DocumentRoot /sub_uri/public
<Directory /sub_uri/public>
...
SetEnv RAILS_RELATIVE_URL_ROOT /sub_uri
</Directory>
</VirtualHost>
I installed Redmine 3.3.1 on a Debian 9.0 Stretch server using the packages provided by the distribution itself (Apache + Redmine + Ruby + Rails + Passenger + MariaDB) more or less following those guides:
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
http://www.redmine.org/projects/redmine/wiki/InstallRedmineOnDebianStableApacheMysqlPassenger
I would like to leave www.example.org "for Apache" and redmine.example.org "for Redmine", so I ended up with the following setup.
I left /etc/apache2/sites-available/000-default.conf untouched and created a file named redmine.conf inside that same folder:
<VirtualHost *:80>
ServerName redmine.example.org
DocumentRoot /usr/share/redmine/public
PassengerRuby /usr/bin/ruby
<Directory /usr/share/redmine/public>
Allow from all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
Then, I've linked it to the sites-enabled folder and restarted Apache:
# ln -s /etc/apache2/sites-available/redmine.conf /etc/apache2/sites-enabled/redmine.conf
# systemctl restart apache2
To set up that virtual host, I followed the directions here:
Deploying a Ruby application on Passenger + Apache
Deploying an app to a virtual host's root
https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/#deploying-an-app-to-a-virtual-host-s-root
I have a linode server and was running a single website for dev purposes using webrick, now i want to put it into production and use Apache2 which I have installed and is up and running the classic It Work's! page which is expected.
Now I want to run multiple sites on this VPS I am using the current configuration which works fine for striaght HTML but will not run the web apps unless I run them on another port (rails s -p3500 etc) as port 80 is already taken up by Apache.
<VirtualHost *:80>
ServerName datumpoint.bizmodev.com
# ServerAlias *.example.com
DocumentRoot /var/www.bizmodev.com
<Directory "/var/www.bizmodev.com">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName homehounduk.co.uk
ServerAlias *.homehounduk.co.uk
DocumentRoot /var/www.homehounduk.co.uk
<Directory "/var/www.homehounduk.co.uk">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Do i need to use passenger or something else to get this working? i have tried changing the virtual hosts to different ports and stuff but just end up getting a 403.
Any help would be appreciated.
this line:
<VirtualHost *:80>
you are telling to your apache that it will listen to anything on port 80
it you change to something like this:
<VirtualHost www.myawesomeurl.com:80>
in this case you are telling apache that everything that comes as a request from this address (www.myawesomeurl.com) on port 80 will use that options.
I think you want something like this:
# Basically your home, like: www.myhome.com
<VirtualHost *:80>
ServerName datumpoint.bizmodev.com
# ServerAlias *.example.com
DocumentRoot /var/www.bizmodev.com
<Directory "/var/www.bizmodev.com">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# Your custom site
<VirtualHost www.something.com:80>
ServerName homehounduk.co.uk
ServerAlias *.homehounduk.co.uk
DocumentRoot /var/www.homehounduk.co.uk
<Directory "/var/www.homehounduk.co.uk">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and dont forget to point the www.something.com to the same ip as the www.myhome.com
Combine this with passenger and you will have one server running many rails apps and many php instances or html pages or anything you want.
I want to set my own sever to run my ruby on rails project(with passenger plugin). I use Apache2 on Ubuntu11.04(sever version).
It's my first time to use Apache and I have read some documents.
All the docs ask me to set SeverName,such as Apache doc and ubuntu docs.
Unfortunately, I don't have a domain name, can I just set IP address and use IP address to access this sever?
If it's ok, how should I do?
It's the config sample given by passenger:
<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public
<Directory /somewhere/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
Thanks!
Comment out the line:
# NameVirtualHost *:80
Comment out any <VirtualHost> blocks.
Find the line:
DocumentRoot "/var/www/html" # or whatever your config uses for the overall apache document root.
Change it to your rails application's root.
DocumentRoot "/somewhere/public"
Then add your other config settings to a <Directory> block.
<Directory /somewhere/public>
AllowOverride all
Options -MultiViews
</Directory>
I haven't tested this for sure, but you should be able to get to it by only visiting the IP address. Make sure you have Passenger installed, have run passenger-install-apache2-module, and have added the appropriate module loading lines to your apache config.
/etc/apache2/httpd.conf
<VirtualHost *:80>
ServerName example.com
DocumentRoot /home/urpc-name/RailsApps/anything/public
<Directory /home/webonise/RailsApps/anything/public>
RailsEnv development
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
In server name:select ur virtual name...u can choose anything
In document root and directory,give your rails project path
Select rails environment in RailsEnv
/etc/hosts
127.0.0.1 example.com
Put server name in virtual host-127.0.0.1 is the localhost
Then just go to your browser and type example.com
Hope this helps