increase fastCGI idle-timeout on MAMP Pro - fastcgi

If you use mamp in cgi mode, to support opcache for instance if your page will take more than 30 seconds to load you get some error similar to
FastCGI: comm with server "/Applications/MAMP/fcgi-bin/php7.4.12.fcgi" aborted: idle timeout (30 sec)
How to increase that?

Solution No 1
Enable xdebug, xdebug is for debugging purposes and you might be in the process of debugging a couple of breakpoints and moving around for a couple of minutes does it make sense that your debugger after 30 seconds stops and tells you OH, well I have to go we can't do this anymore!
So that's why turning the xdebug works, but should you do it?
If you get stuck once in the development and want a fast workaround use xdebug, otherwise don't! Xdebug makes your request a lot slower and gives you a development environment equal to hell, don't ever use xdebug constantly!!! only when you need to debug.
Solution No 2
Add -idle-timeout.
First let's talk about this little nifty menu.
This will let you modify a httpd.conf file, but where is it? Is it the httpd.conf file that will actually be used? NO.
This is just a file full of placeholders, mamp will replace the placeholders in this file and generate a new file and that file will be used at last.
Knowing that was very important since we are going to see the actual output and see how we can edit that to add idle-timeout support.
Step 1. Find the generated file
The generated httpd.conf file is somewhere in your computer, you have to find it first if you are on Linux or MacOS you can use
locate httpd.conf
I have a MacOS and I found that it was at
/Library/Application Support/appsolute/MAMP PRO/conf/httpd.conf
At the top of this file you will read that it is auto-generated by Mamp Pro.
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# It is machine-generated by MAMP PRO, any changes made here will be lost!
Step 2. Find the section about fastcgi in the generated output
Now in this file look for mod_fastcgi.c you will find something like:
<IfModule mod_fastcgi.c>
# URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/
Alias /fcgi-bin/ "/Applications/MAMP/fcgi-bin/"
# Anything in here is handled as a "dynamic" server if not defined as "static" or "external"
<Directory "/Applications/MAMP/fcgi-bin/">
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
# Anything with one of these extensions is handled as a "dynamic" server if not defined as
# "static" or "external". Note: "dynamic" servers require ExecCGI to be on in their directory.
AddHandler fastcgi-script .fcgi .fpl
FastCgiIpcDir /Applications/MAMP/Library/logs/fastcgi
FastCgiServer /Applications/MAMP/fcgi-bin/php8.1.1.fcgi -socket fgci8.1.1.sock
FastCgiServer /Applications/MAMP/fcgi-bin/php7.4.21.fcgi -socket fgci7.4.21.sock
</IfModule>
Step 3. add idle-timeout to FastCgiServer lines from generated file
That is great now all we need to do is to add the -idle-timeout number eg: -idle-timeout 3600 at the end of lines that start with FastCgiServer, so in this example we should have
FastCgiServer /Applications/MAMP/fcgi-bin/php8.1.1.fcgi -socket fgci8.1.1.sock -idle-timeout 3600
FastCgiServer /Applications/MAMP/fcgi-bin/php7.4.21.fcgi -socket fgci7.4.21.sock -idle-timeout 3600
But remember this is the generated file in order to achieve this, we must modify the source file.
Step 4. Put the lines we wrote inside the source file of httpd.conf
Using the Mamp Pro menu we open the source httpd.conf file, again we search for mod_fastcgi.c
this time we'll find
<IfModule mod_fastcgi.c>
# URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/
Alias /fcgi-bin/ "/Applications/MAMP/fcgi-bin/"
# Anything in here is handled as a "dynamic" server if not defined as "static" or "external"
<Directory "/Applications/MAMP/fcgi-bin/">
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
# Anything with one of these extensions is handled as a "dynamic" server if not defined as
# "static" or "external". Note: "dynamic" servers require ExecCGI to be on in their directory.
AddHandler fastcgi-script .fcgi .fpl
MAMP_ActionPhpCgi_MAMP
FastCgiIpcDir /Applications/MAMP/Library/logs/fastcgi
MAMP_FastCgiServer_MAMP
</IfModule>
Matching this to the output, you'll see that MAMP_FastCgiServer_MAMP is the placeholder that gets replaced by FastCgiServer lines! So let's get rid of this placeholder and we'll add those lines ourselves here, in order to do this change the placeholder name slightly eg to: # M#A#M#P_FastCgiServer_MAMP and add the FastCgiServer lines with idle-timeout under or above it eg:
# M#A#M#P_FastCgiServer_MAMP
FastCgiServer /Applications/MAMP/fcgi-bin/php8.1.1.fcgi -socket fgci8.1.1.sock -idle-timeout 3600
FastCgiServer /Applications/MAMP/fcgi-bin/php7.4.21.fcgi -socket fgci7.4.21.sock -idle-timeout 3600
So the full section became
<IfModule mod_fastcgi.c>
# URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/
Alias /fcgi-bin/ "/Applications/MAMP/fcgi-bin/"
# Anything in here is handled as a "dynamic" server if not defined as "static" or "external"
<Directory "/Applications/MAMP/fcgi-bin/">
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
# Anything with one of these extensions is handled as a "dynamic" server if not defined as
# "static" or "external". Note: "dynamic" servers require ExecCGI to be on in their directory.
AddHandler fastcgi-script .fcgi .fpl
MAMP_ActionPhpCgi_MAMP
FastCgiIpcDir /Applications/MAMP/Library/logs/fastcgi
# M#A#M#P_FastCgiServer_MAMP
FastCgiServer /Applications/MAMP/fcgi-bin/php8.1.1.fcgi -socket fgci8.1.1.sock -idle-timeout 3600
FastCgiServer /Applications/MAMP/fcgi-bin/php7.4.21.fcgi -socket fgci7.4.21.sock -idle-timeout 3600
</IfModule>
Step 5. Test our changes by checking the new generated file
Save that restart the servers and look at the generated file
<IfModule mod_fastcgi.c>
# URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/
Alias /fcgi-bin/ "/Applications/MAMP/fcgi-bin/"
# Anything in here is handled as a "dynamic" server if not defined as "static" or "external"
<Directory "/Applications/MAMP/fcgi-bin/">
SetHandler fastcgi-script
Options +ExecCGI
</Directory>
# Anything with one of these extensions is handled as a "dynamic" server if not defined as
# "static" or "external". Note: "dynamic" servers require ExecCGI to be on in their directory.
AddHandler fastcgi-script .fcgi .fpl
FastCgiIpcDir /Applications/MAMP/Library/logs/fastcgi
# M#A#M#P_FastCgiServer_MAMP
FastCgiServer /Applications/MAMP/fcgi-bin/php8.1.1.fcgi -socket fgci8.1.1.sock -idle-timeout 3600
FastCgiServer /Applications/MAMP/fcgi-bin/php7.4.21.fcgi -socket fgci7.4.21.sock -idle-timeout 3600
</IfModule>
The operation was successful, if you changed your php versions just put the placeholder back-on, and repeat these steps.

Related

configuring .htaccess file with multiple subdomains Justhost

Situation is like this :
I have hosting company justhost.com
There I have main domain and two subdomains. First subdomain is with PHP
based webpage, but second is newly created and based on ruby on
rails.
I want such thing, before I am sure that newly created application on RoR is functioning well, keep old one up and running. But somehow when I want modify .htaccess file with code for RoR (source- https://my.justhost.com/cgi/help/rails#access ).
main htacces file located on root_page :
DirectoryIndex index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm home.htm default.htm index.fcgi default.html
# -FrontPage-
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthUserFile /home/ecotec11/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/ecotec11/public_html/_vti_pvt/service.grp
ErrorDocument 404 /404.shtml
AuthName ecotechno.lv
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
htacces file for RoR application:
Options -MultiViews
PassengerResolveSymlinksInDocumentRoot on
#Change to your environment
RailsEnv production
RailsBaseURI /$HOME/$USER/eco
SetEnv GEM_HOME /
This is what I get :
http://gyazo.com/291394024c60284e315b04b3b91128f4 :
It seems that project can't find installed gems or valid rails installation. I tried to update rails installation, but now when it succeded there is no change at all.
Thanks

Wamp Server : Path of uploaded files

Hi I have a WAMP server where some files are upload into an specific path.
C:\wamp\www\upload\
in this case. However could it be possible to upload these files into for example
D:\Documents\User\upload ?
Upload.php specifies the path where the files are stored but I haven´t the way of changing to another path.
Thanks in advance,
Katherine
Edit: upload.php
Here is the upload_file.php
<?php
$target_path = "c:\\";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "El fichero ". basename( $_FILES['uploadedfile']['name'])." ha sido enviado";
} else{
echo "Hubo un error, inténtalo de nuevo!";
}
?>
Katherine,
In WAMP, Apache is setup ( as it should be for security reasons ) so that Apache will not allow access to the root folder of the C:\
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
**Deny from all**
</Directory>
This stops hackers that successfully break into your site from being allowed to cause REALLY SERIOUS DAMAGE.
So I would expect to see an error message in either your Apache error log or your Php error log. I would also expect to see and error on the screen from XDEBUG unless you have disabled that feature. Maybe you should re-enable it as these error messages are really useful while you are developing!!!
change php.ini
display_errors = On
Now it is possible to open up specific folders outside the normal website folder structure like this
This is an excerpt from the httpd.ini without all the comments
<Directory "d:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
Alias /my_other_upload_folder_alias "c:/some_other/folder/my_other_upload_folder"
<Directory "c:/some_other/folder/my_other_upload_folder">
AllowOverride All
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
</Directory>
</Directory>
You then use 'my_other_upload_folder_alias' as the folder name in your php code.
PS. You look like you are placing your site into c:\wamp\www this is a bad idea!
Create subfolders for your sites like this
c:\wamp\www\site1
c:\wamp\www\site2
And think about create one virtualHost per site.

Apache crashing when I add Far-Future Expires clause from Rails Guide

In an attempt to serve my precompiled assets with Apache, per this Rails Guide I try to change this:
<VirtualHost *:82>
ServerName localhost
DocumentRoot "C:/RubyStack-3.2.5-0/projects/release_checklist/public"
<Directory "C:/RubyStack-3.2.5-0/projects/release_checklist/public">
Allow from all
Options -MultiViews
</Directory>
ProxyPass / http://localhost:3001/
ProxyPassReverse / http://localhost:3001/
ProxyPreserveHost On
</VirtualHost>
To this:
<VirtualHost *:82>
ServerName localhost
DocumentRoot "C:/RubyStack-3.2.5-0/projects/release_checklist/public"
<Directory "C:/RubyStack-3.2.5-0/projects/release_checklist/public">
Allow from all
Options -MultiViews
</Directory>
ProxyPass / http://localhost:3001/
ProxyPassReverse / http://localhost:3001/
ProxyPreserveHost On
<LocationMatch "^/assets/.*$">
Header unset ETag
FileETag None
# RFC says only cache for 1 year
ExpiresActive On
ExpiresDefault "access plus 1 year"
</LocationMatch>
</VirtualHost>
in my httpd.conf file. However, the Apache server won't start when the second option has been added. What am I doing wrong?
What error does it give you? Are you sure you have mod_expires compiled into apache and that the module is loaded?
Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration
Yeah, that's usually the error you get if you use a directive that's mapped to a module that isn't loaded (or just a mispelled directive, which appears the same to apache). You'll need to check httpd.conf and make sure the LoadModule expires_module modules/mod_expires.so line is not commented out, of if it's missing, to add it. Depending on your apache's version, the line can be slightly different.

Request exceeded the limit of 10 internal redirects due to probable configuration error

I was trying to remove index.php from the URL of a Magento website:
_Turn on “use webserver rewrite”
_ Set permission 755 to necessary files and folders
_ make sure mode rewrite is on
_ configure htaccess file. comment, uncomment allow symlinks, change rewrite base from /magento/ to / or /var/www/hosts/www.domainname.com/ or /hosts/www.domainname.com/ or /www.domainname.com/
_reindex, flush cache
But all results in 500 server internal error.
In the log file I can see:
[Fri Apr 20 11:11:59 2012] [error] [client 88.87.40.140] client denied by server configuration: /var/www/hosts/www.nordocks.no/app/etc/local.xml
[Fri Apr 20 11:12:07 2012] [error] [client 117.5.178.168] Request exceeded the limit of 10 internal redirects due to probable configuration error.
And this is my .htaccess
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php
############################################
## GoDaddy specific options
# Options -MultiViews
## you might also need to add this line to php.ini
## cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini
############################################
## this line is specific for 1and1 hosting
#AddType x-mapp-php5 .php
#AddHandler x-mapp-php5 .php
############################################
## default index file
DirectoryIndex index.php
<IfModule mod_php5.c>
############################################
## adjust memory limit
# php_value memory_limit 64M
php_value memory_limit 256M
php_value max_execution_time 18000
############################################
## disable magic quotes for php request vars
php_flag magic_quotes_gpc off
############################################
## disable automatic session start
## before autoload was initialized
php_flag session.auto_start off
############################################
## enable resulting html compression
#php_flag zlib.output_compression on
###########################################
# disable user agent verification to not break multiple image upload
php_flag suhosin.session.cryptua off
###########################################
# turn off compatibility with PHP4 when dealing with objects
php_flag zend.ze1_compatibility_mode Off
</IfModule>
<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
<IfModule mod_deflate.c>
############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip
# Insert filter on all content
###SetOutputFilter DEFLATE
# Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
# Netscape 4.x has some problems...
#BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
#BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
#BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
#SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
#Header append Vary User-Agent env=!dont-vary
</IfModule>
<IfModule mod_ssl.c>
############################################
## make HTTPS env vars available for CGI mode
SSLOptions StdEnvVars
</IfModule>
<IfModule mod_rewrite.c>
############################################
## enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
## you can put here your magento root folder
## path relative to web root
#RewriteBase /
############################################
## workaround for HTTP authorization
## in CGI environment
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
############################################
## always send 404 on missing files in these folders
RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
############################################
## never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
############################################
## rewrite everything else to index.php
RewriteRule .* index.php [L]
</IfModule>
############################################
## Prevent character encoding issues from server overrides
## If you still have problems, use the second line instead
AddDefaultCharset Off
#AddDefaultCharset UTF-8
<IfModule mod_expires.c>
############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires
ExpiresDefault "access plus 1 year"
</IfModule>
############################################
## By default allow all access
Order allow,deny
Allow from all
###########################################
## Deny access to release notes to prevent disclosure of the installed Magento version
<Files RELEASE_NOTES.txt>
order allow,deny
deny from all
</Files>
############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags
#FileETag none
Please give me an instruction on how to deal with this error.
On my side it was not a permission problem but simply (and the same is in your .htaccess) the line with:
RewriteBase /
was commented.
Uncommenting it solved the problem.
Set permission 755 to necessary files and folders
You've hit a rock on this one. The permissions have been changed on items that need other permissions than 755 set.
Resetting File Permissions
The base things to watch out for are the files & directories that must be writeable:
- file: magento/var/.htaccess
- directory: magento/app/etc
- directory: magento/var
- all the directories under: magento/media
chmod o+w var var/.htaccess app/etc
chmod -R o+w media
I had this same problem.
The directory for my Magento website on my Ubuntu server is: /var/www/magento
When running Magento initial installation I selected "No" for Use Web Server Rewrites. This setting is under Admin Panel - System - General - Web.
In .htaccess of root magento folder after finishing the initial installation it had:
RewriteBase /magento/
As noted before my folder was /var/www/magento/
I changed Web Server Rewrites to Yes. In .htaccess I changed:
RewriteBase /
Works fine now.
I ran into this issue aswell
adding
RewriteBase /
to the .htaccess brought me a step further.
After this I ran into the next issue:
Could not determine temp directory, please specify a cache_dir manually";i:1;s:4307:"#0 /XXX/XXX/lib/Zend/Cache/Backend.php(217): Zend_Cache::throwException('Could not deter...')
Solution for this was to edit the
\lib\Zend\Cache\Backend\File.php
In the file.php search for
'cache_dir' => null,
and replace with
'cache_dir' => "var/tmp/",
I hope this saves somebody else some time.

My Rails 3 site won't start on Ubuntu/Apache2/Passenger

This server runs on Ubuntu 10.04, particularly on Linode VPS.
Passenger Error:
A source file that the application requires, is missing.
It is possible that you didn't upload your application files correctly. Please check whether all your application files are uploaded.
A required library may not installed. Please install all libraries that this application requires.
Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem.
Error message:
no such file to load -- bundler
Exception class:
LoadError
Application root:
/srv/rails_app/current
I do have bundler installed, I know this because I did "bundle".
Here is my apache configs:
/etc/apache2/sites-enabled/000-default.conf:
<VirtualHost *:80>
PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p0/gems/passenger-2.2.15
PassengerRuby /usr/local/rvm/rubies/ruby-1.9.2-p0/bin/ruby
ServerName 173.230.152.41
DocumentRoot /srv/rails_app/current/public
<Directory "/srv/rails_app/current/public">
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
/etc/apache2/apache2.conf:
#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# The configuration directives are grouped into three basic sections:
# 1. Directives that control the operation of the Apache server process as a
# whole (the 'global environment').
# 2. Directives that define the parameters of the 'main' or 'default' server,
# which responds to requests that aren't handled by a virtual host.
# These directives also provide default values for the settings
# of all virtual hosts.
# 3. Settings for virtual hosts, which allow Web requests to be sent to
# different IP addresses or hostnames and have them handled by the
# same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.log"
# with ServerRoot set to "" will be interpreted by the
# server as "//var/log/apache2/foo.log".
#
### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at <URL:http://httpd.apache.org/docs-2.1/mod/mpm_common.html#lockfile>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/apache2"
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
#<IfModule !mpm_winnt.c>
#<IfModule !mpm_netware.c>
LockFile /var/lock/apache2/accept.lock
#</IfModule>
#</IfModule>
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15
##
## Server-Pool Size Regulation (MPM specific)
##
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
# event MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_event_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy all
</Files>
#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain
#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog /var/log/apache2/error.log
#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn
# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
# Include all the user configurations:
Include /etc/apache2/httpd.conf
# Include ports listing
Include /etc/apache2/ports.conf
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
#
# Define an access log for VirtualHosts that don't define their own logfile
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.
# Include generic snippets of statements
Include /etc/apache2/conf.d/
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p0/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
So how do I go about getting this working?
You need to follow RVM's instructions for generating a passenger wrapper script to use on your PassengerRuby line. Without it, you won't have the proper environment variables set, and Apache won't be able to find the gems installed in that RVM install.
A follow up to #Chris's answer. If your on Ubuntu and using Apache do the following:
rvm install 1.9.2
rvm 1.9.2 --passenger
gem install passenger
rvmsudo passenger-install-apache2-module
Then in your apache.conf add/modify the following lines:
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p0/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p0/gems/passenger-2.2.15
PassengerRuby /usr/local/bin/passenger_ruby
This worked for me, after hours of trawling SO and the rest of the internet.
James
It should be noted that Passenger 3 supports RVM natively without special instructions. The Passenger instructions on the RVM website will become obsolete.

Resources