Apache重啟時報警:
AH00112: Warning: DocumentRoot [/usr/local/apache/docs/dummy-host.example.com] does not exist
AH00112: Warning: DocumentRoot [/usr/local/apache/docs/dummy-host2.example.com] does not exist
問題原因:
Apache在配置虛擬主機時會在配置文件中(httpd.conf)開啟虛擬主機的配置文件;
將“ #Include /etc/httpd/extra/httpd-vhosts.conf ”前面的“#”去掉;
而“httpd-vhosts.conf ”中會有兩個配置虛擬主機的例子:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/local/apache/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/usr/local/apache/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error_log"
CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>
這樣Apache在啟動時就會去尋找以上兩個不存在的文件夾,就會報錯。
解決方法:
方法二:將“httpd-vhosts.conf ”中的例子注釋掉;
#<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host2.example.com
# DocumentRoot "/usr/local/apache/docs/dummy-host2.example.com"
# ServerName dummy-host2.example.com
# ErrorLog "logs/dummy-host2.example.com-error_log"
# CustomLog "logs/dummy-host2.example.com-access_log" common
#</VirtualHost>
問題
$link = mysqli_connect('192.168.0.102','root','123456','my_database');
把192.168.0.102換成127.0.0.1就OK
錯誤代碼是1130,ERROR 1130: Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server 是無法給遠(yuǎn)程連接的用戶權(quán)限問題
解決方法
在mysql命令行輸入
GRANT ALL PRIVILEGES ON *.* TO '數(shù)據(jù)庫用戶名'@'%' IDENTIFIED BY '數(shù)據(jù)庫密碼' WITH GRANT OPTION;
看到Query OK, 0 rows affected, 1 warning (0.01 sec) 表示OK了
問題
Yii2 Gii http://localhost/blogDemo2/backend/web/index.php?r=gii沒問題
http://192.168.0.102/blogDemo2/backend/web/index.php?r=gii就報錯
Forbidden code 403 You are not allowed to access this page
解決方法
在main.php增加
'modules' => [
'gii' => [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.102'],
],
],