108 lines
5.2 KiB
HTML
108 lines
5.2 KiB
HTML
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Part II - Creating a virtual host</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="apj.html" title="Appendix J. Setting up PHP5 in parallel with PHP4 in SuSE 10.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Part II - Creating a virtual host</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Appendix J. Setting up PHP5 in parallel with PHP4 in SuSE 10.1</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="section" title="Part II - Creating a virtual host"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2654968"></a>Part II - Creating a virtual host</h2></div></div></div>
|
|||
|
|
|||
|
<div class="section" title="Step 1; Adding an alias IP-address to Your server"><div class="titlepage"><div><div><h3 class="title"><a name="id2654980"></a>Step 1; Adding an alias IP-address to Your server</h3></div></div></div>
|
|||
|
|
|||
|
<p>In this example we will assume that the server is called "gamma" and have the
|
|||
|
primary address "192.168.0.50". The virtual host will be called "gamma2" and will be
|
|||
|
located at address "192.168.0.51". The easiest way to add another address alias is
|
|||
|
to use yast2 and the network configuration module and simple add a new alias.
|
|||
|
</p>
|
|||
|
</div>
|
|||
|
<div class="section" title="Step 2; Creating different document and cgi roots"><div class="titlepage"><div><div><h3 class="title"><a name="id2654984"></a>Step 2; Creating different document and cgi roots</h3></div></div></div>
|
|||
|
|
|||
|
<p>In preparation of the new virtual host we want it to have a separate document and
|
|||
|
cgi (where we will store the PHP5 binary) roots compared with the standard server.
|
|||
|
For this purpose we add two new directories "/srv/www/gamm2-htdocs/" and
|
|||
|
"/srv/www/gamma2-cgi-bin/" on the server. </p>
|
|||
|
</div>
|
|||
|
<div class="section" title="Step 3; Configure Apache with a virtual host"><div class="titlepage"><div><div><h3 class="title"><a name="id2655010"></a>Step 3; Configure Apache with a virtual host</h3></div></div></div>
|
|||
|
|
|||
|
<p>For his we add a new small config file named "gamma2_vhost.conf" (the exact name
|
|||
|
is not important as long as it ends in *.conf) in the "/etc/apache2/vhosts.d/"
|
|||
|
directory. The script we add is </p>
|
|||
|
<p>
|
|||
|
</p><div class="hl-main"><table class="hl-table" width="100%"><tr><td class="hl-gutter" align="right" valign="top"><pre>1
|
|||
|
2
|
|||
|
3
|
|||
|
4
|
|||
|
5
|
|||
|
6
|
|||
|
7
|
|||
|
8
|
|||
|
9
|
|||
|
10
|
|||
|
11
|
|||
|
12
|
|||
|
13
|
|||
|
14
|
|||
|
15
|
|||
|
16
|
|||
|
17
|
|||
|
18
|
|||
|
19
|
|||
|
20
|
|||
|
21
|
|||
|
22
|
|||
|
23
|
|||
|
24
|
|||
|
25
|
|||
|
26
|
|||
|
27
|
|||
|
28
|
|||
|
29
|
|||
|
30
|
|||
|
31
|
|||
|
32
|
|||
|
33
|
|||
|
34
|
|||
|
35
|
|||
|
36
|
|||
|
</pre></td><td class="hl-main" valign="top"><pre><span class="hl-code"># Setup gamma2 on secondary IP-address
|
|||
|
<VirtualHost 192.168.0.51>
|
|||
|
|
|||
|
DocumentRoot /srv/www/gamma2-htdocs/
|
|||
|
ServerName gamma2
|
|||
|
ServerAdmin root@localhost
|
|||
|
|
|||
|
# We use a separate CGI directory
|
|||
|
ScriptAlias /cgi-bin/ /srv/www/gamma2-cgi-bin/
|
|||
|
|
|||
|
# For good measure we also add recognition of PHP5 index
|
|||
|
DirectoryIndex index.php5
|
|||
|
|
|||
|
# This is the two critical statement for this virtual
|
|||
|
# host we activate PHP5 as a CGI module
|
|||
|
Action php5-cgi /cgi-bin/php
|
|||
|
AddHandler php5-cgi .php5 .php
|
|||
|
|
|||
|
<Directory /srv/www/gamma2-cgi-bin/>
|
|||
|
AllowOverride None
|
|||
|
Options +ExecCGI -Includes
|
|||
|
Order allow,deny
|
|||
|
Allow from all
|
|||
|
</Directory>
|
|||
|
|
|||
|
<Directory "/srv/www/gamma2-htdocs/">
|
|||
|
Options None
|
|||
|
AllowOverride None
|
|||
|
Order allow,deny
|
|||
|
Allow from all
|
|||
|
DirectoryIndex index.html index.php
|
|||
|
</Directory>
|
|||
|
|
|||
|
UserDir public_html
|
|||
|
|
|||
|
</VirtualHost></span></pre></td></tr></table></div><p>
|
|||
|
</p>
|
|||
|
<p>We do not go into any more detail of this configuration since it should be fairly
|
|||
|
easy to understand. For details we refer to the Apache documentation. </p>
|
|||
|
<p>What we have accomplished with this file is that when we call the server on the
|
|||
|
second address any php file will be recognized by apache as a file to be handled by
|
|||
|
the "php5-cgi" action. This in turn means that whenever Apache encounters a *.php5
|
|||
|
(or *.php) file it will run the program "/cgi-bin/php". This path in turn will be
|
|||
|
expanded to " /srv/www/gamma2-cgi-bin/php". </p>
|
|||
|
<p>In the next section we will show how to compile PHP5 and put the executable CGI
|
|||
|
version in this directory.</p>
|
|||
|
</div>
|
|||
|
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="apj.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
|