Centos

虛擬主機僅適用於 2/4 目錄?

  • May 8, 2013

我正在執行 CentOS 6.2,並且在 httpd.conf 中有以下內容:

<VirtualHost *:80>
   ServerAdmin user@example.co.uk
    DocumentRoot /var/www/html/example.co.uk/public
   ServerName example.co.uk
   ErrorLog logs/example.co.uk-error_log
   CustomLog logs/example.co.uk-access_log common
</VirtualHost>
#user1 directory
<VirtualHost *:80>
   ServerAdmin user@example.co.uk
   DocumentRoot /home/user1/public_html    
   ServerName user1.example.co.uk
   ServerAlias www.example.co.uk
   ErrorLog logs/error_log
   CustomLog logs/user1-access_log common
</VirtualHost>
#user2 directory
<VirtualHost *:80>
   ServerAdmin user@example.co.uk
   DocumentRoot /home/user2/public_html
   ServerName user2.example.co.uk
   ServerAlias www.example.co.uk
   ErrorLog logs/error_log
   CustomLog logs/user2-access_log common
</VirtualHost>
#user3 directory
<VirtualHost *:80>
   ServerAdmin user@example.co.uk
    DocumentRoot /home/user3/public_html
   ServerName user3.example.co.uk
   ServerAlias www.example.co.uk
   ErrorLog logs/user3-error_log
   CustomLog logs/access_log common
</VirtualHost>

ServerName example.co.uk這些目錄確實存在,當我導航到而不是 user1 和 user3 時,我能夠看到主虛擬主機()http//exmaple.co.ukhttp://user2.exmaple.co.ukuser2 。誰能發現任何錯誤?

更新 Apache 錯誤日誌:

PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/oci8.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_oci.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
[Wed May 08 15:45:42 2013] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.4.14 configured -- resuming normal operations
[Wed May 08 15:48:02 2013] [notice] caught SIGTERM, shutting down
[Wed May 08 15:48:03 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed May 08 15:48:03 2013] [notice] Digest: generating secret for digest authentication ...
[Wed May 08 15:48:03 2013] [notice] Digest: done
PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/oci8.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_oci.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
[Wed May 08 15:48:03 2013] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.4.14 configured -- resuming normal operations

在此處輸入圖像描述

一遍又一遍地出現相同的錯誤,但 user2 子域工作正常?我只在指向我的 www 文件夾的主要伺服器上保留了 ServerAlia。斯托爾壞了?:(

您在所有虛擬主機上都使用相同的 ServerAlias ……這絕對是一個錯誤 - 我們會看看這是否與您的問題有關。

如果它仍然無法正常工作,我們需要您的日誌輸出和瀏覽器顯示的一些資訊。

引用自:https://serverfault.com/questions/506056