| 10 | == Installing and configuring critical helper packages == |
| 11 | |
| 12 | Being able to send and receive email often part of the web application development process. |
| 13 | |
| 14 | {{{ |
| 15 | 0 fidel:~# aptitude install mailx esmtp-run |
| 16 | }}} |
| 17 | |
| 18 | You will then want to edit the /etc/esmtprc file, modifying the following lines: |
| 19 | |
| 20 | {{{ |
| 21 | # Config file for ESMTP sendmail |
| 22 | |
| 23 | # The SMTP host and service (port) |
| 24 | hostname=chavez.mayfirst.org:587 |
| 25 | |
| 26 | # The user name |
| 27 | username= |
| 28 | |
| 29 | # The password |
| 30 | password= |
| 31 | |
| 32 | #qualifydomain=@mayfirst.org |
| 33 | #force sender=alfredo@mayfirst.org |
| 34 | #force reverse_path=alfredo@mayfirst.org |
| 35 | |
| 36 | # Whether to use Starttls |
| 37 | starttls=enabled |
| 38 | }}} |
| 39 | |
| 40 | FIXME: I can't properly send mail with this configuration, I get the following error: |
| 41 | |
| 42 | {{{ |
| 43 | Invalid peer certificate (error 20) |
| 44 | 0 (null) |
| 45 | jamie@mayfirst.org: 0 (null) |
| 46 | Can't send mail: sendmail process failed with error code 70 |
| 47 | }}} |
| 48 | |
| 49 | This could be related to a known [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=310968 bug in esmtp]. |
| 50 | |
12 | | == Configuring PHP, Apache, and MySQL == |
| 53 | Install the required packages with: |
| 54 | |
| 55 | {{{ |
| 56 | aptitude install mysql-server php5-cgi php5-cli libapache2-mod-suphp apache2-mpm-prefork php5-mysql |
| 57 | }}} |
| 58 | |
| 59 | == Configuring the environment == |
| 60 | |
| 61 | The goal of the configuration is to make it as easy as possible to setup a new development environment for a new project. |
| 62 | |
| 63 | Each new project will have a unique, non-public domain name based on the name of the workstation. In this example, let's assume the workstation is named "fidel." So - a new project called mfpl would have the development domain name: mfpl.fidel (below we will edit the /etc/hosts file so that this non-public domain name will resolve to the development workstation). |
| 64 | |
| 65 | Apache can be configured so that it dynamically sets the document root based on the domain name. |
| 66 | |
| 67 | To enable that feature, create a new file called virtual-document-roots in the /etc/apache2/sites-available directory with the following contents (replace your-username with your actual username). |
| 68 | |
| 69 | {{{ |
| 70 | VirtualScriptAlias /home/your-username/projects/%1/cgi-bin/ |
| 71 | VirtualDocumentRoot /home/your-username/projects/%1/web/ |
| 72 | }}} |
| 73 | |
| 74 | Next enable the vhost_alias module and the site configuration file you just created with: |
| 75 | |
| 76 | {{{ |
| 77 | a2enmod vhost_alias |
| 78 | a2ensite virtual-document-roots |
| 79 | }}} |
| 80 | |