【发布时间】:2016-02-05 05:47:16
【问题描述】:
所以这引起了我的注意。我想区分 /etc/httpd.conf 和 /etc/httpd.conf.pre-update 并更正默认的 LoadModules 和包含的升级应用,但我有许多虚拟主机玩得不好。在升级之前一切都很好,但都失败了:
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 时,它会返回标准的“它可以工作!”来自 /Library/WebServer/Documents/index.html.en 的文件。此目录仅从 /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
我看了这么久,我错过了一些非常明显的东西,不是吗。请让我摆脱痛苦。
谢谢。
【问题讨论】:
标签: macos apache osx-elcapitan