Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.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

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
/public_html/httptest.php';找不到或无法统计-指示灯_Php_Apache_Ubuntu_Lamp - Fatal编程技术网

/public_html/httptest.php';找不到或无法统计-指示灯

/public_html/httptest.php';找不到或无法统计-指示灯,php,apache,ubuntu,lamp,Php,Apache,Ubuntu,Lamp,我目前在LAMP服务器上设置了一个域,我想添加另一个域。我试着自己做,但当我遇到问题时,我就跟着做 我已经设置了example.com,它工作正常,所有流量都会重定向到它的https,我想继续。尝试重新启动apache2后,我现在收到一条错误消息: script '/var/www/html/test.ca/public_html/httptest.php' not found or unable to stat 我在apache2.conf文件中搜索了httptest.php,但没有找到匹配

我目前在LAMP服务器上设置了一个域,我想添加另一个域。我试着自己做,但当我遇到问题时,我就跟着做

我已经设置了example.com,它工作正常,所有流量都会重定向到它的https,我想继续。尝试重新启动apache2后,我现在收到一条错误消息:

script '/var/www/html/test.ca/public_html/httptest.php' not found or unable to stat
我在apache2.conf文件中搜索了
httptest.php
,但没有找到匹配的

/etc/apache2/sites available/000-default.conf

<VirtualHost *:80>
    ServerName example.com
    Redirect permanent / https://example.com/
</VirtualHost>
<VirtualHost *:80>
    ServerName test.ca
    Redirect permanent / http://test.ca
</VirtualHost>
<VirtualHost *:443>
    SSLEngine On
    SSLCertificateFile /etc/ssl/localcerts/example.com.crt
    SSLCertificateKeyFile /etc/ssl/localcerts/example.com.key
    SSLCACertificateFile /etc/ssl/localcerts/intermediate.crt

    ServerAdmin example@gmail.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/html/example.com/public_html/
    ErrorLog /var/www/html/example.com/logs/error.log
    CustomLog /var/www/html/example.com/logs/access.log combined

    <Directory /var/www/html/example.com/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:443>
    ServerAdmin example@gmail.com
    ServerName test.ca
    ServerAlias www.test.ca
    DocumentRoot /var/www/html/test.ca/public_html/
    ErrorLog /var/www/html/test.ca/logs/error.log
    CustomLog /var/www/html/test.ca/logs/access.log combined
    <Directory /var/www/html/test.ca/>
        Require all granted
    </Directory>
</VirtualHost>
当我在/var/www/html/I中执行
ls-l
时,我得到:

-rw-r--r-- 1 root root 11510 Dec 15 20:49 index.html
drwxr-xr-x 4 root root  4096 Jan 11 19:19 test.ca
drwxr-xr-x 4 root root  4096 Dec 15 21:00 example.com
然后将其更改为:

-rw-r--r-- 1 root root 11510 Dec 15 20:49 index.html
drwxr-xr-x 4 sys  sys   4096 Jan 11 19:19 test.ca
drwxr-xr-x 4 sys  sys   4096 Dec 15 21:00 example.com
我已经运行了下面的代码,它说这两个功能都已启用:

sudo a2ensite example.com
sudo a2ensite test.ca

错误发生在apache重新启动时。

是否已激活虚拟主机?如果不是
使用内置的apache快捷方式激活主机:

sudo a2ensite example.com
sudo a2ensite test.ca
然后重新启动Apache服务:

sudo service apache2 restart

还要检查项目文件夹的权限

是的,我已经这样做了,重新启动apache2
script'/var/www/html/test.ca/public_html/httptest.php“未找到或无法统计”
/etc/hosts
文件中有以下条目:
127.0.0.1 example.com test.ca
?它有我的服务器ip,然后主机名看起来像:
#serverName
类似于:什么?您好,我想问您是否用SSL证书解决了该错误?我用权限解决了它
sudo a2ensite example.com
sudo a2ensite test.ca
sudo a2ensite example.com
sudo a2ensite test.ca
sudo service apache2 restart