0
votes

everybody.

I have a Cent OS 6.6 server with Apache + mod_php site (site1.local). I need to configure second site (site2.local) with php_cgi. So, I created a user, gave him permissions on www-folder, configured site1 as mod_php, created a phpinfo.php. Also, I installed php-cgi,and try to configure virtual hosts, works only first site, on the second site is error:

the requested url /cgi-bin/phpinfo.php was not found onthis server.

That's my configs: cat /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/wwwmaster/site1.local
    ServerName     site1.local
    ServerAlias www.site1.local
    ErrorLog logs/site1.local-error_log
    CustomLog logs/site1.local-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/wwwmaster/site2.local
    ServerName     site2.local
    ServerAlias www.site2.local

    ScriptAlias   /cgi_bin/    /usr/bin/php-cgi/
    Action        php-cgi        /cgi-bin
    AddHandler    php-cgi        php

    <Directory /usr/bin/php-cgi>
        Allow from all
    </Directory>

    <Directory "/var/www/wwwmaster/site2.local/">
        <FilesMatch "\.php">
            SetHandler    php-cgi
        </FilesMatch>
        Options Indexes FollowSymLinks    Includes ExecCGI
        AllowOverride All    
        Order Deny,Allow
        Allow from all
    </Directory>

    ErrorLog logs/site2.local-error_log
    CustomLog logs/site2.local-access_log common
</VirtualHost>

What I've done wrong and how can I fix that?

1

1 Answers

0
votes

You only have to uncomment the line that says NameVirtualServer *:80 in your apache config file.

If you want virtual server for more than one port, simply put as many NameVirtualServer *:[port number] in the apache config file as you need.