Parse HTML as PHP

The more files the server determines it needs to pass through the PHP interpreter, the more overhead involved, but I think this goes without saying. If your site does not have ANY pages with plain HTML, then you’re already paying all the performance penalties that you could possibly pay – adding HTML to the list … Read more

Only variable references should be returned by reference – Codeigniter

Edit filename: core/Common.php, line number: 257 Before return $_config[0] =& $config; After $_config[0] =& $config; return $_config[0]; Update Added by NikiC In PHP assignment expressions always return the assigned value. So $_config[0] =& $config returns $config – but not the variable itself, but a copy of its value. And returning a reference to a temporary … Read more

Authorization header missing in django rest_framework, is apache to blame?

If you are using Apache and mod_wsgi, then I found the easy solution to this in the official Django REST framework website Apache mod_wsgi specific configuration Note that if deploying to Apache using mod_wsgi, the authorization header is not passed through to a WSGI application by default, as it is assumed that authentication will be … Read more

Apache2 ProxyPass for Rails App Gitlab

I came across this gist that worked for me. In case it ever goes dead, I’ll repost it. unicorn config file Edit file /home/gitlab/gitlab/config/unicorn.rb Find line listen “#{app_dir}/tmp/sockets/gitlab.socket” and comment it. Uncomment line listen “127.0.0.1:8080” required modules for apache sudo a2enmod proxy sudo a2enmod proxy_balancer sudo a2enmod proxy_http sudo a2enmod rewrite /home/gitlab/gitlab/config/gitlab.conf <VirtualHost *:80> ServerName … Read more

multiple django sites with apache & mod_wsgi

Your ServerName/ServerAlias directives are wrong. ServerName should be hostname. You probably should just delete ServerAlias. Then just do the obvious and duplicate VirtualHost/Listen directives, just changing the port number and locations of scripts in the file system. Finally, do not set DocumentRoot to be where your Django code is as it makes it easier to … Read more

Correct owner/group/permissions for Apache 2 site files/folders under Mac OS X?

This is the most restrictive and safest way I’ve found, as explained here for hypothetical ~/my/web/root/ directory for your web content: For each parent directory leading to your web root (e.g. ~/my, ~/my/web, ~/my/web/root): chmod go-rwx DIR (nobody other than owner can access content) chmod go+x DIR (to allow “users” including _www to “enter” the … Read more