Installation:Debian:Apache

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

On Debian GNU/Linux you need to install the following packages:

  • apache or apache2
  • php4
  • php4-gd
  • php4-mysql
  • phpmyadmin

On Debian GNU/Linux use this command to install all at once:

apt-get install apache php4 php4-gd php4-mysql phpmyadmin

Open /etc/apache/httpd.conf with your favorite editor.Setup "ServerAdmin" and "ServerName" with the correct values concerning your server. Comment out or delete the following section:

#
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is received.
#
<IfModule mod_userdir.c>
    UserDir public_html 
</IfModule>

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /home/*/public_html>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS PROPFIND>
        Order allow,deny
        Allow from all  
    </Limit>
    <Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
        Order deny,allow
        Deny from all   
    </Limit>
</Directory>

as this is not needed and not possible an this server.

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 32 to server version: 4.0.16-log 

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

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

mysql> exit
Bye
Apache Virtual Host from SQL

Apache 1.x First of all we have to download

http://rpmseek.com/rpm/libapache-mod-sqlinclude_1.4-1_i386.html?hl=de&cbd=0:L:80:1598681:18:0:0

Then we run

dpkg -i libapache-mod-sqlinclude_1.4-1_i386.deb

After install edit /etc/apache/httpd.conf. Remove any

NameVirtualHost and VirtualHost

entries from this file and add at module section

LoadModule sqlinclude_module /usr/lib/apache/1.3/mod_sqlinclude.so

and at the end

SQL_ServerName "localhost"
SQL_ServerPort 3306
SQL_SQLDB pmwh
SQL_SQLUser apache
SQL_SQLPassword apache-password
SQL_Include "SELECT conact(data,data2) from subdomains where data <> '' order by domain"
SQL_AbortOnError On
SQL_UseNameColumn Off

Configuration of apache is done.

Apache 2.x 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 "php4-mysql" package uses "libmysqlclient10" then you have to install "libmysqlclient10-dev" (not "libmysqlclient12-dev" !).

Now we have installed mod_sqlinclude :)

Enabling mod_sqlinclude

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

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/pmwh and add here following.

SQL_ServerName "localhost"
SQL_ServerPort 3306
SQL_SQLDB pmwh
SQL_SQLUser apache
SQL_SQLPassword apache-password
SQL_Include "SELECT data from subdomains where data <> '' order by domain"
SQL_AbortOnError On
SQL_UseNameColumn Off

Remove default virtualhosts and configurations and add dynamic pmwh sites.

a2dissite 000-default
a2ensite pmwh

Configuration of apache2 is done.