Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 找不到虚拟主机对象_Apache_Ubuntu_Xampp_Virtualhost - Fatal编程技术网

Apache 找不到虚拟主机对象

Apache 找不到虚拟主机对象,apache,ubuntu,xampp,virtualhost,Apache,Ubuntu,Xampp,Virtualhost,每次我尝试访问https://sub.myproject.test/弹出此消息: 找不到对象! 在此服务器上找不到请求的URL。如果您手动输入URL,请检查拼写并重试。 如果您认为这是服务器错误,请联系网站管理员。 错误404 sub.myproject.test Apache/2.4.38(Unix)OpenSSL/1.0.2q PHP/7.2.15 mod_perl/2.0.8-dev perl/v5.16.3 在httpd vhosts.conf上我有: <VirtualHost *

每次我尝试访问
https://sub.myproject.test/
弹出此消息:

找不到对象! 在此服务器上找不到请求的URL。如果您手动输入URL,请检查拼写并重试。 如果您认为这是服务器错误,请联系网站管理员。 错误404 sub.myproject.test Apache/2.4.38(Unix)OpenSSL/1.0.2q PHP/7.2.15 mod_perl/2.0.8-dev perl/v5.16.3

在httpd vhosts.conf上我有:

<VirtualHost *:80>
    DocumentRoot "/mnt/data/myproject/sub.myproject.com/public_html"
    ServerName sub.myproject.test
    ServerAlias www.sub.myproject.test
    <Directory  "/mnt/data/myproject/sub.myproject.com/public_html/">
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
当然,在
/mnt/data/myproject
路径中,我有
sub.myproject.com
文件夹

如果您能帮我解决这个问题,我们将非常感谢您的VirtualHost是正常的(除非您不需要在ServerName和ServerAlias指令中添加:443),但是如果请求中没有指定,您永远不会告诉Apache默认显示哪个页面

在每个虚拟主机中定义
DirectoryIndex

例如:
DirectoryIndex.html
当请求被拒绝时 ,因此在域名之后没有任何内容,Apache将从
DocumentRoot
目录显示index.html


与您的问题无关,您应该将
ServerTokens Prod
ServerSignature Off
放在配置中,您的错误消息显示了大量信息

# catalog config
<VirtualHost *:443>
    DocumentRoot "/mnt/data/myproject/sub.myproject.com/public_html"
    ServerName sub.myproject.test:443
    ServerAlias www.sub.myproject.test:443
    ErrorLog "/opt/lampp/logs/error_log"
    TransferLog "/opt/lampp/logs/access_log"
    SSLEngine on

    SSLCertificateFile "/opt/lampp/etc/ssl.crt/server.crt"
    SSLCertificateKeyFile "/opt/lampp/etc/ssl.key/server.key"

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>

    <Directory "/mnt/data/myproject/sub.myproject.com/public_html/">
        SSLOptions +StdEnvVars +FakeBasicAuth

        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Allow from all
        Require all granted
    </Directory>
    BrowserMatch "MSIE [2-5]" \
             nokeepalive ssl-unclean-shutdown \
             downgrade-1.0 force-response-1.0
    CustomLog "/opt/lampp/logs/ssl_request_log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>