我正在尝试在 OSX 上设置 apache2,但遇到了问题。我尝试将域代理到 127.0.0.1:8081(已启动并正在运行),但尝试通过 apache 加载时,我收到“未找到网页”消息。我在 error_log 中也没有收到任何信息来表明发生了什么,并且“apachectl configtest”返回 OK。这些指令在运行 apache2 的 Linux 服务器上运行正常。
启动 apache 后,我在日志中看到的最后一条消息是:[通知] Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8r DAV/2 已配置 - 恢复正常操作
任何帮助都将非常有帮助,但我不是 Apache 专家!
/private/etc/apache2/extra/http-vhosts.conf
TransferLog /var/log/apache2/transfer_log
ProxyRequests Off
NameVirtualHost *:443
#
# THIS IS WORKING OK
# EVERYTHING ON PORT 80 IS CHANGED TO HTTPS
#
<VirtualHost *:80>
ProxyRequests Off
ProxyPreserveHost On
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</Virtualhost>
<VirtualHost *:443>
# I have an entry in /etc/hosts pointing mydomain.com to 127.0.0.1
# and http://mydomain.com gets redirected to https://mydomain.com ok
ServerName mydomain.com
SSLProxyEngine On
SSLProxyMachineCertificateFile /etc/ssl/certs/mycert.pem
ProxyRequests Off
ProxyPreserveHost On
#
# 127.0.0.1:8081 is up and running OK
#
ProxyPass / http://127.0.0.1:8081/
ProxyPassReverse / http://127.0.0.1:8081/
TransferLog /var/log/apache2/ssl_access_log
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLCertificateFile /etc/ssl/certs/mycert.crt
SSLCertificateKeyFile /etc/ssl/certs/mykey.key
SSLCertificateChainFile /etc/ssl/certs/mybundle.crt
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog /var/log/apache2/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
谢谢!
答案1
结果是 httpd.conf 中的包含内容被注释掉了。
更改:
<IfDefine !MACOSXSERVER>
#Include /private/etc/apache2/extra/httpd-ssl.conf
</IfDefine>
到:
<IfDefine !MACOSXSERVER>
Include /private/etc/apache2/extra/httpd-ssl.conf
</IfDefine>
现在一切正常:)