Apache-2.2

伺服器在我的 VPS 主機上顯示預設 CGI 頁面

  • January 20, 2013

即使將 index.php 放在 root/public_html 文件夾中,我也會得到預設的 cgi [http://xx.xxx.xxx.xxx/cgi-sys/defaultwebpage.cgi ] 頁面。

我的 VPS 上的 Httpd Conf 有以下條目

<VirtualHost 127.0.0.1:80 *>
   ServerName server1.mydomain.com
   ServerAlias cpanel.* whm.* webmail.* webdisk.* autodiscover.* autoconfig.*
   DocumentRoot /usr/local/apache/htdocs
   ServerAdmin admin@mydomain.com
   <IfModule mod_suphp.c>
       suPHP_UserGroup nobody nobody
   </IfModule>
   RewriteEngine On
   <IfModule core.c>
       SSLProxyEngine On
   </IfModule>
   RewriteCond %{HTTP_HOST} ^cpanel\.
   RewriteCond %{HTTPS} on
   RewriteRule ^/(.*) https://127.0.0.1:2083/$1 [P]
   RewriteCond %{HTTP_HOST} ^webmail\.
   RewriteCond %{HTTPS} on
   RewriteRule ^/(.*) https://127.0.0.1:2096/$1 [P]
   RewriteCond %{HTTP_HOST} ^whm\.
   RewriteCond %{HTTPS} on
   RewriteRule ^/(.*) https://127.0.0.1:2087/$1 [P]
   RewriteCond %{HTTP_HOST} ^webdisk\.
   RewriteCond %{HTTPS} on
   RewriteRule ^/(.*) https://127.0.0.1:2078/$1 [P]
   RewriteCond %{HTTP_HOST} ^cpanel\.
   RewriteRule ^/(.*) http://127.0.0.1:2082/$1 [P]
   RewriteCond %{HTTP_HOST} ^webmail\.
   RewriteRule ^/(.*) http://127.0.0.1:2095/$1 [P]
   RewriteCond %{HTTP_HOST} ^whm\.
   RewriteRule ^/(.*) http://127.0.0.1:2086/$1 [P]
   RewriteCond %{HTTP_HOST} ^webdisk\.
   RewriteRule ^/(.*) http://127.0.0.1:2077/$1 [P]
   RewriteCond %{HTTP_HOST} ^autodiscover\.
   RewriteRule ^[^?]*(\?.*)? http://127.0.0.1/cgi-sys/autodiscover.cgi [P]
   RewriteCond %{HTTP_HOST} ^autoconfig\.
   RewriteRule ^[^?]*(\?.*)? http://127.0.0.1/cgi-sys/autoconfig.cgi [P]
   UseCanonicalName Off
</VirtualHost>

我需要進行哪些更改才能使專用 IP 從 public_html 文件夾載入 index.php。

請幫忙

您的 documentroot 需要從 DocumentRoot /usr/local/apache/htdocs 更改

DocumentRoot /root/public_html

/root 是一個有公共 html 的不尋常的地方,如果你有 selinux 執行,你將被阻止訪問它,sestatus如果有疑問,請檢查

如果您仍然沒有運氣,請嘗試如下所示的基本虛擬主機,然後逐漸更改您上面的條目,直到您發現問題

<VirtualHost xx.xx.xx.xx:80>
   ServerName server1.mydomain.com
   DocumentRoot /root/public_html
   DirectoryIndex index.php
   <Directory /root/public_html>
    order allow, deny
    allow from all
   </Directory
</VirtualHost>

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