Cannot deploy the application with capistrano & passenger to Centos - apache

I have Centos 7. I've installed Passenger & Apache. After deploying the application to the server with Capistrano. I get the error:
Could not find rake-12.0.0 in any of the sources (Bundler::GemNotFound)
I've set owner group of working folder to apache (and nobody). But it is nothing.
My apache configuration:
<VirtualHost *:80>
ServerName ...
# Be sure to point to 'public'!
DocumentRoot /home/kanna/www/bb/current/public
<Directory /home/kanna/www/bb/current/public>
# Relax Apache security settings
AllowOverride all
Require all granted
# MultiViews must be turned off
Options -MultiViews
SetEnv GEM_HOME /home/kanna/www/bb/shared/bundle/ruby/2.3.0/gems
</Directory>
</VirtualHost>
Thanks.

I added line into Directory:
PassengerRuby /home/kanna/.rvm/gems/ruby-2.3.3/wrappers/ruby
If you want to see debug information you can add the line:
PassengerFriendlyErrorPages on

Related

Can start Apache through command line but not through Wamp Server

I have wampserver 3.1.4 running on Windows 10. It starts php & MySql OK but it won't start Apache.
I can run httpd.exe from the command line and it starts no problem.
The EventViewer tells me I have a Syntax error in my vhosts file on the DocumentRoot line, but I've checked the paths and everything is correct, and it starts OK from the CLI.
Seems to be that wampapache64 has a misconfiguration somewhere.
This is my httpd-vhosts.conf file
The Syntax error occurs on the 'DocumentRoot' line in the second block.
If I remove the second block it works fine.
The path to the folder is correct
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName local.shiftlegal.co.nz
DocumentRoot "c:/projects/true/shift/shiftlegal.co.nz"
<Directory "c:/projects/true/shift/shiftlegal.co.nz/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
I should also note that this exact configuration was working a couple of days ago.
I get 2 error messages in the Windows EventViewer every time I try to run wamp:
The Apache service named reported the following error:
>>> AH00526: Syntax error on line 16 of C:/wamp64/bin/apache/apache2.4.35/conf/extra/httpd-vhosts.conf: .
The Apache service named reported the following error:
>>> DocumentRoot must be a directory .
Well.
I'm not exactly sure what happened but it turns out it had not very much to do with wampserver.
It seems my projects folder was corrupted somehow. I created a new folder and added a project and it worked.
Thanks #RiggsFolly for all your help.

XAMPP Virtual Hosts not working

Before marking this as answered, please read the entire thing because yes there is a good amount of these questions but NONE of the answers on them have worked at all.
For the last 6 months I've looked at around 50 different form posts here and around the web to try and get my XAMPP virtual hosts working.
Hosts File
127.0.0.1 localhost
127.0.0.1 vws.localhost
127.0.0.1 instancegaming.net
127.0.0.1 vws.instancegaming.net
http-vhosts File (Updated 7/26)
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
# NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:\xampp\htdocs"
<Directory "C:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
I'm at a loss of what to do, I've tried putting all fields to localhost then to instancegaming.net but nothing seems to work. I've read the Apache log and there's only SSL errors floating around.
When I try going to [ http:// ] vws.localhost, vws.192.168.0.47, vws.instancegaming.net all of which give the same error in chrome:
ERR_NAME_NOT_RESOLVED
Then I tried emptying chromes host cache, but that didn't help either.
Sidenote: I reinstalled XAMPP 4 times trying to make this work.
Follow these steps if you are in windows environment (7 & 10 tested) with XAMPP:
Add in hosts file [C:\Windows\System32\drivers\etc]
127.0.0.1 vws.localhost
127.0.0.1 instancegaming.net
127.0.0.1 vws.instancegaming.net
Add this in httpd.conf [C:\__Server\apache\conf] . though some says there are security risks with this but couldn't find a way without this
<Directory />
AllowOverride none
Require all granted
</Directory>
Add these in httpd-vhosts.conf [C:\__Server\apache\conf\extra]
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:\__Server\htdocs"
<Directory "C:\__Server\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName tools.com.at
DocumentRoot "E:\phpStorms\git\tools-class"
SetEnv APPLICATION_ENV "development"
<Directory "E:\phpStorms\git\tools-class">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName laravel.test.com.at
DocumentRoot "E:\laravel.test.com.at\public"
SetEnv APPLICATION_ENV "development"
<Directory "E:\laravel.test.com.at\public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
template of this
<VirtualHost *:80>
ServerName nameInHostsFile
DocumentRoot "pathOfTheWindowsFileLocationWhichWillBeDocumentRoot"
SetEnv APPLICATION_ENV "development"
<Directory "pathOfTheWindowsFileLocationWhichWillBeDocumentRoot">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Note 1: My xampp installed on C:\__Server location
Note 2 : My folder name is laravel.test.com.at and its in E: drive E:\laravel.test.com.at
Note 3: Always copy folder location from address bar in windows explorer, so there is no mistakes.
Note 4: You must restart XAMPP after editing httpd-vhosts.conf every time.
Note 5: Use uncommon part in url [i.e .com.at] so that it is unique and there is no issue resolving dns.
Update: troubleshoot#Jacob Jewett
After a fresh copy of XAMPP installation in C drive -
just add/append these line in httpd-vhosts.conf file
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:\xampp\htdocs"
<Directory "C:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName vws.localhost
DocumentRoot "C:\xampp\vws"
SetEnv APPLICATION_ENV "development"
<Directory "C:\xampp\vws">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Add append this in httpd.conf file
<Directory />
AllowOverride none
Require all granted
</Directory>
ADD PATH variable for php [C:\xampp\php], and also check that there isn't another php path in the PATH variable.
restart xampp and browse localhost
Additionally make sure that the line
Include etc/extra/httpd-vhosts.conf
is not quoted out in httpd.conf
The answer I found that works is to to this in the hosts file.
192.168.0.47 localhost somthing.instancegaming.net
One thing I'd like to add here: For anyone who is sure everything is setup correctly, make sure you don't use any underscores in the alias string within your hosts file; for some reason it can't accept underscores.
I have similar issue, vhosts not working. But in my case I found there was the permission issue with host file. Hope this helps for some one. hosts file ignored, how to troubleshoot?
If pings are successful but a Virtual Host is not working with XAMPP 7.3.1 and Windows 10 Pro the problem may be interference with the World Wide Web Publishing Service.
On my system, Apache and MySQL start successfully but the virtual host cannot be browsed till I stop the WWWPS service (in Windows Services). The virtual host then becomes instantly available. It instantly stops working when the WWWPS is started again.
I fixed the problem by just restarting my computer after setting up the System32 file hosts and the apache vhosts.

Apache virtualhost with debian 8

I would like to configure an apache virtualhost with Debian 8
I have installed apache2
I have create a configuration in sites-available
<VirtualHost *:80>
ServerName wiki.domain.com
ServerAlias wiki.domain.com
DocumentRoot /home/www/htdocs/wiki/
<Directory /home/www/htdocs/wiki/>
Options -Indexes FollowSymLinks
AllowOverride All
</Directory>
ErrorLog /home/www/logs/wiki/wiki_error.log
LogLevel warn
CustomLog /home/www/logs/wiki/wiki_access.log combined
ServerSignature Off
</VirtualHost>
Create a symbolic link in sites-enabled
ln -s /etc/apache2/sites-available/wiki /etc/apache2/sites-enabled/wiki
And reboot apache
/etc/init.d/apache2 restart
This configuration works with Debian 7 but with Debian 8 i am not redirected to my wiki directory when I use my domain wiki.domain.com
Add Require all granted in the directory to allow apache to access to your directory
Here is an easiest and recommanded way to enable a site with apache2:
a2ensite wiki && service apache2 restart

Apache in Debian Jessie - still get message You don't have permission to access / on this server

The same virtual config i apache wheezy works right.
For example:
ServerName lgbs
ServerAlias www.lgbs
DocumentRoot /home/vdomain/app/web
SetEnv APPLICATION_ENV "development"
<Directory /home/vdomain/app/web>
# enable the .htaccess rewrites
AllowOverride All
Order allow,deny
Allow from All
</Directory>
But on Debian testing 'Jessie' i still get message:
Forbidden You don't have permission to access / on this server.
Apache/2.4.9 (Debian) Server at test Port 80
Of course a check file permision and i set rwx for evryones and owner and group is www-data.
Thanks for help
This drove me crazy for a couple of hours. Apparently in 2.4.9 ( I upgraded from 2.2.2 ) there is a "Require all granted" that you need to add to each directory.
In my http.conf:
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>
So basically what I had to do was:
<Directory "/Users/johndoe/Sites">
Require all granted
</Directory>

Need help setting up passenger with apache

I'm trying to setup passenger with apache on Fedora 14. The install went ok but I'm unable to configure apache correctly.
I made these changes to the file. I cannot start apache unless I comment out the virtual host portion.
LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.7
PassengerRuby /usr/bin/ruby
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/antarr/pull/public
<Directory /home/antarr/pull/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
You also need the following two lines in your apache2.conf or in a conditionally loaded, module specific conf file:
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7
PassengerRuby /usr/local/bin/ruby
Instead of modifying httpd-vhosts.conf override DocumentRoot in your httpd.conf
# Override default DocumentRoot with you root
DocumentRoot "/home/antarr/pull/public"
<Directory "/home/antarr/pull/public">
Allow from all
Options -MultiViews
Require all granted
</Directory>
Before restarting server make sure your conf change is reflected
apachectl -S
The Document root should point to your root folder. And restart apache.