The location of the apache modules in the standard OSX build.
/usr/libexec/apache2
The location of the apache modules in the standard OSX build.
/usr/libexec/apache2
Here’s how I applied some custom virtual host configuration for a CPanel account. Note that you need to have root access to the box. (Or get your hosting company to do it for you)
Example user: foobar
Example domain: foobar.co.uk
Create the directory structure/usr/local/apache/conf/userdata/std/2/foobar/foobar.co.uk.
Where:
std = standard config (ssl for secure hosts)
2 = major version number of apache
foobar = username of the account
foobar.co.uk = domain of the account
Create a vhost.conf file. The file can be any name, but must have the .conf extension. In this file put the override config. For example:
DocumentRoot /home/foobar/newrooot CustomLog /home/foobar/logs/foobar.log combined |
Note the lack of the opening and closing directives.
Create an .htpasswd file for your login credentials:
htpasswd -c .htpasswd someuser |
Create your .htaccess file:
AuthUserFile /full/path/to/.htpasswd AuthType Basic AuthName "Protected Area" Require valid-user |
Steps completed on Ubuntu 10.04
Generate CA (CN should have CA suffix to prevent conflict)
openssl genrsa -des3 -out ca.key 4096 openssl req -new -x509 -days 3650 -key ca.key -out ca.crt |
generate server key and request (CSR)
openssl genrsa -des3 -out server.key 4096 openssl req -new -key server.key -out server.csr |
Generate CRT from CSR
openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt |
Make server.key with no passphrase for Apache
openssl rsa -in server.key -out server.key.insecure mv server.key server.key.secure mv server.key.insecure server.key |
Set permissions
chown root server.key chmod 600 server.key |
Add to the setup method in the file config/ProjectConfiguration.class.php
$this->setWebDir($this->getRootDir().DIRECTORY_SEPARATOR.'public_html'); |
I assume you have Apache 2 installed and running on your server.
To list the loaded modules:
sudo apache2ctl -M |
Enable mod_rewrite:
locate mod_rewrite.so // make a note of the location cd /etc/apache2/mods-enabled sudo touch rewrite.load sudo vi rewrite.load |
Add this line, using the path of the module found using locate:
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so |
Restart apache.
To prevent PHP scripts from executing in a directory add this code to an .htaccess file
<Directory "/path/to/my/sfProject/web/uploads"> php_flag engine off </Directory> |