WebFaction
Community site: login faq

Hello,

I've set up a custom apache instance following the directions at "Installing a private instance of the shared apache" in an attempt to have a specific development setup with a custom apache config and vhost aliases. The desired effect is that I should be able to go to anysubdomain.domain.com and it will server up the contents of my webapps/_dev/anysubdomain/ folder. I've got it mostly working, other than when I visit a php page it forces a download of the php source code rather than actually being parsed by php itself.

Here is my current httpd.conf file so far:

LoadModule rpaf_module               /usr/lib/httpd/modules/mod_rpaf.so
LoadModule dav_module                /usr/lib64/httpd/modules/mod_dav.so
LoadModule dav_svn_module            /usr/lib64/httpd/modules/mod_dav_svn.so
LoadModule dav_fs_module             /usr/lib64/httpd/modules/mod_dav_fs.so
LoadModule authz_svn_module          /usr/lib64/httpd/modules/mod_authz_svn.so
LoadModule authz_host_module         /usr/lib64/httpd/modules/mod_authz_host.so
LoadModule authz_groupfile_module    /usr/lib64/httpd/modules/mod_authz_groupfile.so
LoadModule authz_owner_module        /usr/lib64/httpd/modules/mod_authz_owner.so
LoadModule authz_user_module         /usr/lib64/httpd/modules/mod_authz_user.so
LoadModule log_config_module         /usr/lib64/httpd/modules/mod_log_config.so
LoadModule mime_module               /usr/lib64/httpd/modules/mod_mime.so
LoadModule dir_module                /usr/lib64/httpd/modules/mod_dir.so
LoadModule rewrite_module            /usr/lib64/httpd/modules/mod_rewrite.so
LoadModule proxy_module              /usr/lib64/httpd/modules/mod_proxy.so
LoadModule proxy_connect_module      /usr/lib64/httpd/modules/mod_proxy_connect.so
LoadModule proxy_http_module         /usr/lib64/httpd/modules/mod_proxy_http.so
LoadModule proxy_ftp_module          /usr/lib64/httpd/modules/mod_proxy_ftp.so
LoadModule auth_basic_module         /usr/lib64/httpd/modules/mod_auth_basic.so
LoadModule auth_digest_module        /usr/lib64/httpd/modules/mod_auth_digest.so
LoadModule authn_file_module         /usr/lib64/httpd/modules/mod_authn_file.so
LoadModule cgid_module               /usr/lib64/httpd/modules/mod_cgid.so
LoadModule alias_module              /usr/lib64/httpd/modules/mod_alias.so
LoadModule autoindex_module          /usr/lib64/httpd/modules/mod_autoindex.so
LoadModule deflate_module            /usr/lib64/httpd/modules/mod_deflate.so
LoadModule setenvif_module           /usr/lib64/httpd/modules/mod_setenvif.so
LoadModule headers_module            /usr/lib64/httpd/modules/mod_headers.so
LoadModule logio_module              /usr/lib64/httpd/modules/mod_logio.so
LoadModule include_module            /usr/lib64/httpd/modules/mod_include.so
LoadModule expires_module            /usr/lib64/httpd/modules/mod_expires.so
LoadModule env_module                /usr/lib64/httpd/modules/mod_env.so
LoadModule actions_module            /usr/lib64/httpd/modules/mod_actions.so
LoadModule negotiation_module        /usr/lib64/httpd/modules/mod_negotiation.so
LoadModule fastcgi_module            /usr/lib/httpd/modules/mod_fastcgi.so
LoadModule speling_module            /usr/lib64/httpd/modules/mod_speling.so
LoadModule vhost_alias_module        /usr/lib64/httpd/modules/mod_vhost_alias.so

ServerRoot /home/username/private_apache
Listen 127.0.0.1:12345
NameVirtualHost 127.0.0.1:12345
KeepAliveTimeout 3
KeepAlive Off
MaxRequestsPerChild 5000
Timeout 60
PidFile /home/username/private_apache/logs/httpd.pid
TypesConfig /etc/httpd/conf/mime.types
LogLevel warn
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /home/username/logs/user/privateApache_access.log combined
ErrorLog /home/username/logs/user/privateApache_error.log

# Control the max number of FastCGI processes:
# Set maxClassProcesses and maxProcesses to the same limit number. Leave procesSlack at 1.
# http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html
FastCgiConfig -maxClassProcesses 2 -maxProcesses 2 -processSlack 1

# WILDCARDS ---------
< VirtualHost 127.0.0.1:12345>
    ServerName dev.domain.ca
    ServerAlias *.dev.domain.ca
    VirtualDocumentRoot /home/username/webapps/_dev/%1/
    DirectoryIndex index.html index.htm index.cgi index.php
    ProxyPreserveHost on
    AddDefaultCharset utf-8
    AddHandler cgi-script .cgi
    Alias /cgi-bin/php55.cgi /home/php-cgi/php55.cgi
    Action php55-cgi /cgi-bin/php55.cgi
    Include /home/username/private_apache/conf/extra/httpd-autoindex.conf
    < Directory /home/username/webapps/_dev/%1>
      AllowOverride all
      < FilesMatch \.ht(access|passwd)>
        Deny from all
      < /FilesMatch>
      < FilesMatch (\.user\.ini|php\.ini)>
        Deny from all
      < /FilesMatch>
      < FilesMatch \.php$>
        SetHandler php55-cgi
      < /FilesMatch>
    < /Directory>
< /VirtualHost>

asked 23 Apr '14, 20:33

smacd
17116
accept rate: 0%


The problem you're describing is exactly what this section exists to address:

< FilesMatch \.php$>
  SetHandler php55-cgi
< /FilesMatch>

If that's not working, can you try replacing this:

Alias /cgi-bin/php55.cgi /home/php-cgi/php55.cgi
Action php55-cgi /cgi-bin/php55.cgi

with this?:

Alias /cgi-bin/php55.cgi /home/php-cgi/php55.cgi
Action php55-cgi /cgi-bin/php55.cgi
AddHandler php55-cgi .php

In other words, try adding "AddHandler php55-cgi .php" and see if it makes a difference.

If it does, let me know and I'll update the Private Instance of the Shared Apache guide.

permanent link

answered 24 Apr '14, 00:48

ryans ♦♦
5.0k93460
accept rate: 43%

Thanks adding "AddHandler php55-cgi .php" did the trick!

(24 Apr '14, 02:43) smacd
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×225
×27
×4

question asked: 23 Apr '14, 20:33

question was seen: 10,566 times

last updated: 24 Apr '14, 02:43

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM