gpt4 book ai didi

php -/public_html/httptest.php' 未找到或无法统计 - LAMP

转载 作者:搜寻专家 更新时间:2023-10-31 21:26:54 25 4
gpt4 key购买 nike

我目前在我的 LAMP 服务器上设置了一个域,我想添加另一个域。我尝试自己做,但是当我遇到问题时,我遵循 this .

我设置了 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>

/etc/apache2/sites-available/example.com.conf

<VirtualHost *:80>
ServerName example.com
Redirect permanent / https://example.com/
</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>

/etc/apache2/sites-available/test.ca.conf

<VirtualHost *:80>
ServerName test.ca
Redirect permanent / http://test.ca
</VirtualHost>
<VirtualHost *:444>
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>

我的/etc/hosts 文件说(它有我的 ip):

127.0.0.1 myservername

当我在/var/www/html/中执行 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

同时检查项目文件夹的权限

关于php -/public_html/httptest.php' 未找到或无法统计 - LAMP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34754880/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com