是否可以安装几个Apache实例或有几个php.ini?

时间:2013-06-16 08:13:31

标签: php apache configuration

嗯......标题解释了几乎所有内容......是否可以安装多个Apache实例或者有几个php.ini?

我的服务器中有几个客户有不同的要求,我需要安装2个apach或者有2个php.ini用于这些配置。

如果可能,我如何根据URL选择配置?

提前致谢!

2 个答案:

答案 0 :(得分:1)

使用mod-fastcgi或mod-fcgi,它将PHP作为单独的独立守护进程运行。然后,对于每个网站,您可以定义一个单独的用户和php.ini配置文件。

答案 1 :(得分:0)

您可以执行虚拟主机,您可以基于用于访问服务器的域。在每个虚拟主机的配置中,您可以根据客户需求自定义内容。您可以使用google“apache2虚拟主机”获取文档,但以下是虚拟服务器的示例:

<VirtualHost 10.0.0.1:80>
    ServerAdmin webmaster@example.com

    DocumentRoot /var/vhosts/example.com/www
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/vhosts/example.com/www>
            Options -Indexes FollowSymLinks MultiViews

            php_admin_value open_basedir /var/www/vhosts/example.com/www
            php_admin_value disable_functions exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source

            php_admin_value session.referer_check example.com
            php_admin_value session.cache_limiter nocache

            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ServerName example.com
    ServerAlias *.example.com

    ErrorDocument 400 /errors/400.html
    ErrorDocument 401 /errors/401.html
    ErrorDocument 402 /errors/402.html
    ErrorDocument 403 /errors/403.html
    ErrorDocument 404 /errors/404.html
    ErrorDocument 405 /errors/405.html
    ErrorDocument 406 /errors/406.html
    ErrorDocument 407 /errors/407.html
    ErrorDocument 408 /errors/408.html
    ErrorDocument 409 /errors/409.html
    ErrorDocument 410 /errors/410.html
    ErrorDocument 411 /errors/411.html
    ErrorDocument 412 /errors/412.html
    ErrorDocument 413 /errors/413.html
    ErrorDocument 414 /errors/414.html
    ErrorDocument 415 /errors/415.html
    ErrorDocument 500 /errors/500.html
    ErrorDocument 501 /errors/501.html
    ErrorDocument 502 /errors/502.html
    ErrorDocument 503 /errors/503.html
    ErrorDocument 504 /errors/504.html
    ErrorDocument 505 /errors/505.html

    ServerSignature Off
    LogLevel error

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^(www).* [NC]
    RewriteCond %{HTTP_HOST} ^([^\.]+)\.([^\.]+)\.com
    RewriteCond /var/vhosts/%2/www/%1 -d
    RewriteRule ^(.*) /%1/$1 [L]
</VirtualHost>

这表明使用了很多设置,包括设置一些php设置。