El Capitan 升级和 Apache VHost 问题
El Capitan upgrade and Apache VHost problems
所以这引起了我的注意。我想在 /etc/httpd.conf 和 /etc/httpd.conf.pre-update 之间进行区分,并更正应用升级的默认 LoadModules 和 Includes,但我有一些虚拟主机没有播放很好。升级前一切都很好,但失败的原因如下:
http://localhost (DocumentRoot /www works fine)
http://test (DocumentRoot /www/test serves "It works!" from the standard DocumentRoot and nothing shows in /var/log/apache2/access_log)
http://test/index.php (works)
http://localhost/test (works)
httpd.conf 提取
DocumentRoot "/www"
<Directory "/www">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
httpd-vhosts.conf 提取
<VirtualHost *:80>
DocumentRoot "/www/test"
ServerName test
</VirtualHost>
ServerName 在 /etc/hosts 中设置并且 ping 正确,并且在显式指定文件时有效,因此看起来不错。还尝试使用 test.local(并作为 ServerAlias 进行测试),但没有任何区别。
DirectoryIndex 已设置为 "index.php index.html",这没有任何区别,并且 http://localhost/test" 正确地服务于 index.php,看起来应该是这样。
并且当 http://test 被访问时,它 returns 来自 /Library/WebServer/Documents/index.html.en 的标准 "It works!" 文件。此目录仅从 /etc/apache2/original/httpd.conf 和 /etc/apache2/extra/httpd-ssl.conf.
引用
httpd -V 显示正在使用正确的 conf
Server version: Apache/2.4.16 (Unix)
Server built: Aug 22 2015 16:51:57
Server's Module Magic Number: 20120211:47
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FLOCK_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/bin/suexec"
-D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
httpd -S 显示网站加载正确
VirtualHost configuration:
*:80 is a NameVirtualHost
default server localhost (/private/etc/apache2/extra/httpd-vhosts.conf:24)
port 80 namevhost localhost (/private/etc/apache2/extra/httpd-vhosts.conf:24)
port 80 namevhost phpmyadmin (/private/etc/apache2/extra/httpd-vhosts.conf:29)
port 80 namevhost site1.local (/private/etc/apache2/extra/httpd-vhosts.conf:34)
port 80 namevhost ideas.local (/private/etc/apache2/extra/httpd-vhosts.conf:39)
port 80 namevhost site2.local (/private/etc/apache2/extra/httpd-vhosts.conf:44)
port 80 namevhost site3.local (/private/etc/apache2/extra/httpd-vhosts.conf:49)
port 80 namevhost site4 (/private/etc/apache2/extra/httpd-vhosts.conf:54)
port 80 namevhost site5 (/private/etc/apache2/extra/httpd-vhosts.conf:59)
port 80 namevhost site6 (/private/etc/apache2/extra/httpd-vhosts.conf:64)
port 80 namevhost site7 (/private/etc/apache2/extra/httpd-vhosts.conf:69)
port 80 namevhost site8 (/private/etc/apache2/extra/httpd-vhosts.conf:74)
port 80 namevhost test (/private/etc/apache2/extra/httpd-vhosts.conf:79)
ServerRoot: "/usr"
Main DocumentRoot: "/www"
Main ErrorLog: "/private/var/log/apache2/error_log"
Mutex default: dir="/private/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex proxy: using_defaults
PidFile: "/private/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="_www" id=70 not_used
Group: name="_www" id=70 not_used
*.local 站点加载正确,尽管它们的 DocumentRoots 如下:
/www/site1/public
我已经看了很久了,我错过了一些非常明显的东西,不是吗。请让我摆脱痛苦。
谢谢。
因此,最终结果似乎是要么我非常非常愚蠢,要么 Safari 的缓存系统非常非常愚蠢。
我去拿外套...
(我仍然对 El Capitan 严重破坏我的系统感到震惊 - 我显然还有很多东西要学习 OSX)
所以这引起了我的注意。我想在 /etc/httpd.conf 和 /etc/httpd.conf.pre-update 之间进行区分,并更正应用升级的默认 LoadModules 和 Includes,但我有一些虚拟主机没有播放很好。升级前一切都很好,但失败的原因如下:
http://localhost (DocumentRoot /www works fine)
http://test (DocumentRoot /www/test serves "It works!" from the standard DocumentRoot and nothing shows in /var/log/apache2/access_log)
http://test/index.php (works)
http://localhost/test (works)
httpd.conf 提取
DocumentRoot "/www"
<Directory "/www">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
httpd-vhosts.conf 提取
<VirtualHost *:80>
DocumentRoot "/www/test"
ServerName test
</VirtualHost>
ServerName 在 /etc/hosts 中设置并且 ping 正确,并且在显式指定文件时有效,因此看起来不错。还尝试使用 test.local(并作为 ServerAlias 进行测试),但没有任何区别。
DirectoryIndex 已设置为 "index.php index.html",这没有任何区别,并且 http://localhost/test" 正确地服务于 index.php,看起来应该是这样。
并且当 http://test 被访问时,它 returns 来自 /Library/WebServer/Documents/index.html.en 的标准 "It works!" 文件。此目录仅从 /etc/apache2/original/httpd.conf 和 /etc/apache2/extra/httpd-ssl.conf.
引用httpd -V 显示正在使用正确的 conf
Server version: Apache/2.4.16 (Unix)
Server built: Aug 22 2015 16:51:57
Server's Module Magic Number: 20120211:47
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FLOCK_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/bin/suexec"
-D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
httpd -S 显示网站加载正确
VirtualHost configuration:
*:80 is a NameVirtualHost
default server localhost (/private/etc/apache2/extra/httpd-vhosts.conf:24)
port 80 namevhost localhost (/private/etc/apache2/extra/httpd-vhosts.conf:24)
port 80 namevhost phpmyadmin (/private/etc/apache2/extra/httpd-vhosts.conf:29)
port 80 namevhost site1.local (/private/etc/apache2/extra/httpd-vhosts.conf:34)
port 80 namevhost ideas.local (/private/etc/apache2/extra/httpd-vhosts.conf:39)
port 80 namevhost site2.local (/private/etc/apache2/extra/httpd-vhosts.conf:44)
port 80 namevhost site3.local (/private/etc/apache2/extra/httpd-vhosts.conf:49)
port 80 namevhost site4 (/private/etc/apache2/extra/httpd-vhosts.conf:54)
port 80 namevhost site5 (/private/etc/apache2/extra/httpd-vhosts.conf:59)
port 80 namevhost site6 (/private/etc/apache2/extra/httpd-vhosts.conf:64)
port 80 namevhost site7 (/private/etc/apache2/extra/httpd-vhosts.conf:69)
port 80 namevhost site8 (/private/etc/apache2/extra/httpd-vhosts.conf:74)
port 80 namevhost test (/private/etc/apache2/extra/httpd-vhosts.conf:79)
ServerRoot: "/usr"
Main DocumentRoot: "/www"
Main ErrorLog: "/private/var/log/apache2/error_log"
Mutex default: dir="/private/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex proxy: using_defaults
PidFile: "/private/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="_www" id=70 not_used
Group: name="_www" id=70 not_used
*.local 站点加载正确,尽管它们的 DocumentRoots 如下:
/www/site1/public
我已经看了很久了,我错过了一些非常明显的东西,不是吗。请让我摆脱痛苦。
谢谢。
因此,最终结果似乎是要么我非常非常愚蠢,要么 Safari 的缓存系统非常非常愚蠢。
我去拿外套...
(我仍然对 El Capitan 严重破坏我的系统感到震惊 - 我显然还有很多东西要学习 OSX)