我得到了默认的 cgi [http://xx.xxx.xxx.xxx/cgi-sys/defaultwebpage.cgi]页面即使将 index.php 放在 root/public_html 文件夹中。
我的 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 [email protected]
<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。
请帮忙
答案1
您的 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>