Installation:Ubuntu:Apache2

From PMWH2 - PHPMyWebHosting's official wiki
Jump to: navigation, search
up

On Ubuntu 7.10 Server you need to install the following packages:

  • apache2
  • php5
  • php5-cgi
  • php5-gd
  • php5-mysql (for mySQL) or php5-pgsql (for postgreSQL)
  • phpmyadmin (for mySQL) or phppgadmin (for postgreSQL)

On Ubuntu 7.10 Server use this command to install all at once:

mySQL

apt-get install apache2 php5 php5-gd php5-mysql phpmyadmin

PostgreSQL

apt-get install apache2 php5 php5-gd php5-pgsql phppgadmin

Then we have to create a user which has only read access to the domain data.

bash #> mysql -u root -p mysql
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.45-Debian_1ubuntu3.1-log Debian etch distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 

mysql> GRANT SELECT on pmwh2.* to 'apache2'@'localhost' identified by "apache2-password";
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
Apache Virtual Host from SQL
only with mysql, working on mod_pg_sqlinclude. comming soon.

On Ubuntu 7.10 Server you need to install the following packages:

  • apache2-prefork-dev

On Ubuntu 7.10 Server use this command to install all at once:

apt-get install apache2-prefork-dev

Download File:Mod sqlinclude-for-apache2.tar.gz. Unpack the sources under /usr/src (or whatever you want) and run "make && make install". Perhaps you have to install some development files to build the module. Make sure that you have correct MySQL API version development files installed before compiling. If your "php5-mysql" package uses "libmysqlclient15" then you have to install "libmysqlclient15-dev" (not "libmysqlclient12-dev" !).

Now we have installed mod_sqlinclude :) You can ignore some errors like:

apxs:Error: Activation failed for custom /etc/apache2/httpd.conf file..
apxs:Error: At least one `LoadModule' directive already has to exist..
Enabling mod_sqlinclude

edit /etc/apache2/httpd.conf (keep this file clean)

Create new module by creating file /etc/apache2/mods-available/mod_sqlinclude.load and add here following.

LoadModule sqlinclude_module  /usr/lib/apache2/modules/mod_sqlinclude.so

enable mod_sqlinclude

a2enmod mod_sqlinclude
Enabling rewrite and urlforwarding possibility
a2enmod proxy
a2enmod rewrite
Virtual Host from SQL

Create new site by creating file /etc/apache2/site-available/pmwh2 and add here following.

SQL_ServerName "localhost"
SQL_ServerPort 3306
SQL_SQLDB pmwh2
SQL_SQLUser apache
SQL_SQLPassword apache-password
SQL_AbortOnError Off
SQL_UseNameColumn On
SQL_Verbose 1
SQL_Include "SELECT data, subdomain from apache_subdomains where data <> '' order by domain"

Add dynamic pmwh2 sites.

a2ensite pmwh2

Configuration of apache2 is done. next step