時(shí)間:2023-02-07 16:36:01 | 來(lái)源:建站知識(shí)
時(shí)間:2023-02-07 16:36:01 來(lái)源:建站知識(shí)
[root@ etc]# cat /etc/redhat-releaseCentOS release 6.9 (Final)
[root@ etc]# httpd -vServer version: Apache/2.2.15 (Unix)Server built: Oct 19 2017 16:43:38
LoadModule rewrite_module modules/mod_rewrite.so
?#vhost conf fileInclude "vhost/*.conf"?
[root@ httpd]# pwd/etc/httpd[root@ httpd]# lltotal 12drwxr-xr-x 2 root root 4096 Jun 28 19:46 confdrwxr-xr-x 2 root root 4096 Oct 24 2017 conf.dlrwxrwxrwx 1 root root 19 Oct 24 2017 logs -> ../../var/log/httpdlrwxrwxrwx 1 root root 29 Oct 24 2017 modules -> ../../usr/lib64/httpd/moduleslrwxrwxrwx 1 root root 19 Oct 24 2017 run -> ../../var/run/httpddrwxr-xr-x 2 root root 4096 Jun 28 19:47 vhost
<VirtualHost *:80> ServerAdmin 1184795629@qq.com DocumentRoot /var/code/mallServerName www.xxx.cn ServerAlias xxx.cn<Directory "/var/code/mall"> Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all</Directory></VirtualHost>
<VirtualHost *:80> ServerAdmin 1184795629@qq.com DocumentRoot /var/code/mallServerName mall.phpersay.cn <Directory "/var/code/mall"> Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all</Directory></VirtualHost>
<VirtualHost *:80> ServerAdmin 1184795629@qq.com DocumentRoot /var/code/blogServerName www.phpersay.cn <Directory "/var/code/blog"> Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all</Directory></VirtualHost>
[root@ etc]#service httpd restart
127.0.0.1 phpersay.com127.0.0.1 mall.phpersay.com127.0.0.1 xxxx.cn
重啟網(wǎng)絡(luò)[root@ etc]# /etc/init.d/network
重啟web服務(wù)器Apache的進(jìn)程httpd[root@ etc]#service httpd restartStopping httpd: [ OK ]Starting httpd: [ OK ]
然并非有用答案。#NameVirtualHost *:80
[root@iZ23hnwptztZ etc]# service httpd restartStopping httpd: [ OK ]Starting httpd: [Mon Jun 28 18:40:25 2021] [warn] NameVirtualHost xxx.xx.xx.110:80 has no VirtualHosts [ OK ]
引起這個(gè)警告的原因是NameVirtualHost語(yǔ)法錯(cuò)誤 ,對(duì)于同一主機(jī)支持多個(gè)虛擬主機(jī)的情況,只需要命名一次NameVirtualHost,如果在每個(gè)虛擬主機(jī)配置文件中都加上NameVirtualHost *:80 ,則會(huì)報(bào)這個(gè)警告。NameVirtualHost *:80NameVirtualHost xxx.xx.xx.xxx:80
vhost/web.conf<VirtualHost *:80> ServerAdmin 1184795629@qq.com DocumentRoot /var/code/blogServerName www.phpersay.cn <Directory "/var/code/blog"> Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all</Directory></VirtualHost>
錯(cuò)誤原因就是在httpd.conf文件中,重復(fù)定義了NameVirtualHost,刪除該行,重啟Apache即可。關(guān)鍵詞:配置
客戶&案例
營(yíng)銷資訊
關(guān)于我們
客戶&案例
營(yíng)銷資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。