VirtualHost文件仅适用于localhost用户,而不适用于任何ip,无论是公共,私有还是自己。以下是放在sites-enabled
文件夹中的VirtualHost文件内容:
<VirtualHost *:80>
ServerName localhost
ServerAdmin root@localhost
DocumentRoot /home/matecat/cattool
DirectoryIndex index.php index.php3 index.html index.htm index.shtml
<Directory /home/matecat/cattool/>
Options All
AllowOverride All
<IfVersion < 2.4>
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>
ExpiresActive On
ExpiresByType text/html "access plus 1 hour"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/jpg "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType image/vnd.microsoft.icon "access plus 1 week"
ExpiresByType image/ico "access plus 1 week"
ExpiresByType application/x-shockwave-flash "access plus 1 week"
</Directory>
php_flag register_globals off
php_flag magic_quotes_gpc off
php_admin_flag short_open_tag on
php_value memory_limit 1024M
php_value upload_max_filesize 200M
php_value post_max_size 200M
LogLevel error
ErrorLog /var/log/apache2/matecat.error.log
CustomLog /var/log/apache2/matecat.log combined
ServerSignature Off
# Configuration for Nodejs proxy
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /sse/ >
ProxyPass http://0.0.0.0:7788/
ProxyPassReverse http://0.0.0.0:7788/
</Location>
</VirtualHost>
我评论了以下几行:
Servername localhost
ServerAdmin root@localhost
但重新启动apache服务器后仍然无法使用系统的“IPv4”。
答案 0 :(得分:1)
如果您没有指定域,并通过IP访问它,Apache将使用它找到匹配的第一个VirtualHost,自上而下。
这里,任何IP(*),端口80.因此,如果没有注释掉默认配置VirtualHost,Apache将使用此默认配置。因此,请注释掉默认值,或者移动默认值。但无论如何,没有人需要默认配置: - )