<VirtualHost *:80>
# ... server name/aliases and such.
DocumentRoot /var/www/html
RackEnv staging
RackBaseURI /extapp/forms
<Directory /var/www/html/extapp/forms>
Options -MultiViews
PassengerRuby /home/pstn/.rbenv/versions/2.1.2/bin/ruby
</Directory>
</VirtualHost>
/var/www/html/extapp/forms is a symlink linking to the public folder of a rails 4 application, all permissions for the directory tree are correct (r+w).
Passenger boots, as per the entry in the logs:
[ 2014-09-08 14:07:17.5896 21559/7f8d77305720 agents/Watchdog/Main.cpp:728 ]: All Phusion Passenger agents started!
However, when I visit the appropriate path, all I get is a directory listing of the files residing in the public folder (i.e. robots.txt et. al.)
Try this
<Directory /var/www/html/extapp/forms>
Options -MultiViews
PassengerRuby /home/posten/.rbenv/versions/2.1.2/bin/ruby
PassengerResolveSymlinksInDocumentRoot on
</Directory>
Then restart the server.
My server config is
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName mysite
RailsEnv development
DocumentRoot /var/www/mysite/public
<Directory /var/www/mysite/public>
Allow from all
Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/ruby-error.log
CustomLog ${APACHE_LOG_DIR}/ruby-access.log combined
# For most configuration files from conf-available/, which are
</VirtualHost>
Related
I am using spree-multi-domain
store1.localhost:3000 is working fine locally
but when I moved my code on the live server I am unable to make it working.
When I hit URL store1.mydomain.com it is giving me an error.
ERROR:
This site can’t be reached
abc.mydomain.com’s server IP address could not be found.
DNS_PROBE_FINISHED_NXDOMAIN
Also I have tried adding this
config.action_dispatch.tld_length = 2
in config/enviroments/production.rb
I am on apache server . Do I need to do anything on server side as well to make it working ?
Apache Config:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster#localhost
ServerName mydomain.com
ServerAlias mydomain.com rails
# ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
#DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
in /etc/apache2/sites-available/000-default.conf
Server name missing from your apache config for subdomain:
<VirtualHost *:80>
ServerName store1.mydomain.com
# Tell your app's 'public' directory path
DocumentRoot /var/www/store1.mydomain.com/public
</VirtualHost>
For dynamic or n subdomains:
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias *.mydomain.com
# Tell your app's 'public' directory path
DocumentRoot /var/www/mydomain.com/public
</VirtualHost>
I have installed wamp in C:\wamp and I want to make DocumentRoot folder in E:\zf2 as virtual host for a dummy domain www.skeltonapplicaiton-zf2.local.
Uncommitted the line Include conf/extra/httpd-vhosts.conf in httpd.conf file.
httpd-vhosts.conf code is
<VirtualHost *:80>
ServerName www.skeltonapplicaiton-zf2.local
ServerAlias skeltonapplicaiton-zf2.local
DocumentRoot "E:\zf2"
<directory "E:\zf2">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from all
</directory>
</VirtualHost>
Added its entry in hosts file as
127.0.0.1 www.skeltonapplicaiton-zf2.local
127.0.0.1 skeltonapplicaiton-zf2.local
Then restarted the wamp server.
After opening www.skeltonapplicaiton-zf2.local in browser I am getting error
Forbidden
You don't have permission to access / on this server.
Apache Error log is
[Fri Aug 08 11:00:41.940054 2014] [authz_core:error] [pid 7256:tid 796] [client 127.0.0.1:59500] AH01630: client denied by server configuration: E:/zf2/
Your all setting is correct, but there are some changes in apache 2.4 (wamp 2.5 uses apache 2.4) that is the directive Allow was dropped in favor of new directive Require . The correct configuration will be with virtual host is
<VirtualHost *:80>
ServerName www.skeltonapplicaiton-zf2.local
ServerAlias skeltonapplicaiton-zf2.local
DocumentRoot "E:\zf2"
<directory "E:\zf2">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</directory>
</VirtualHost>
So, Just Remove
Order Deny,Allow
Deny from all
Allow from all
and use
Require all granted
host name:dhs
<VirtualHost *:80>
DocumentRoot "/var/www/dhs/public/"
ServerName dhs
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/var/www/dhs/public/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
host name: deforay
<VirtualHost *:80>
DocumentRoot "/var/www/deforay/public/"
ServerName deforay
# This should be omitted in the production environment
SetEnv APPLICATION_ENV development
<Directory "/var/www/deforay/public/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
but dhs(e.g: dhs/) opening the deforay host , am using in zend framework 2, the "deforay" host is working good but not dhs... i also added dhs in hosts's file
your config seems valid, the only way that may could be wrong is that you don't activated named based virtual hosts.
to get that work insert into your vhost config file NameVirtualHost *:80 (edit the port if you use a different one)
make sure your host file includes
127.0.0.1 dhs
127.0.0.1 deforay
and access your webpage in your browser with
http://dhs
http://deforay
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
I have installed symfony sandbox 1.2 and created a virtual host by modifying apache config like this (following this tut http://www.symfony-project.org/askeet/1_0/en/1 but I adapted as sandbox dirs are different from their tuts):
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
ServerName askeet
DocumentRoot "c:/webserver/www/sf_sandbox/web"
DirectoryIndex index.php
Alias /sf "c:/webserver/www/sf_sandbox/web/images/sf"
<Directory "c:/webserver/www/sf_sandbox/web">
AllowOverride All
Allow from All
</Directory>
<Directory "c:/webserver/www/sf_sandbox/web/images/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
And modified my hosts file to map askeet to 127.0.0.1
It works fine except symfony tells me:
If you see no image in this page, you
may need to configure your web server
so that it gains access to the
symfony_data/web/sf/ directory.
Indeed I can't see any images which are stored in c:/webserver/sf_sandbox/web/images/sf as for my symfony sandbox, why ?
Your hosts file should be
<VirtualHost 127.0.0.1:80>
ServerName askeet
DocumentRoot "c:/webserver/www/sf_sandbox/web"
DirectoryIndex index.php
Alias /sf "c:/webserver/www/sf_sandbox/web/sf"
<Directory "c:/webserver/www/sf_sandbox/web">
AllowOverride All
Allow from All
</Directory>
<Directory "c:/webserver/www/sf_sandbox/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
because the sf directory is in web/ directory and not in web/images directory?