最近从Win XP(x86)迁移到Win 7(x64),我还必须重新安装Apache。我已经安装了64位版本的Apache(2.4.3)和PHP(2.4)。
我将它安装到c:\ Apache24。
我已经启动并运行,但现在我需要将其锁定到我的本地PC。
如果我有:
<Directory "c:/Apache24/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
# New directive needed in Apache 2.4.3 apparently:
Require all granted
</Directory>
这种方法很好,但如果我将其更改为:
<Directory "c:/Apache24/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from 127.0.0.1
# New directive needed in Apache 2.4.3 apparently:
Require all granted
</Directory>
(或'允许来自Localhost'或'允许来自192.x.y.z')
我收到拒绝访问错误。我怎么能绕过这个?
使用我的登录信息安装所有内容,该登录信息具有完全本地管理员权限。
答案 0 :(得分:21)
替换
Order allow,deny
Allow from all
Require all granted
只是
Require local
更多:http://httpd.apache.org/docs/2.4/en/mod/mod_authz_host.html
答案 1 :(得分:2)
一种方法是add Listen
to httpd.conf:
Listen 127.0.0.1:80
如果还有其他Listen
指令,请记得删除其他<Directory>
指令。
请注意,这将锁定整个服务器,因此它只响应来自localhost的请求。如果您需要逐个目录地微调权限,请使用<Directory /var/www/secure>
Require local
</Directory>
语法:
SELECT STR_TO_DATE(CONCAT(tb.cohort), '%Y-%m-%d') as date,
m1,
m2,
m3,
m4
FROM
(SELECT u.cohort, IFNULL(SUM(s.Offset = 0), 0) m1,
IFNULL(SUM(s.Offset = 1), 0) m2,
IFNULL(SUM(s.Offset = 2), 0) m3,
IFNULL(SUM(s.Offset = 3), 0) m4
FROM
(SELECT id, DATE_FORMAT(created_at, '%Y-%m') AS cohort FROM deviceinfo
WHERE created_at BETWEEN '2017-09-01' AND '2017-11-30' ) as u
LEFT JOIN
(SELECT DISTINCT sessions.deviceid, FLOOR(DATEDIFF(sessions.start_time,
deviceinfo.created_at)/30) AS Offset
FROM sessions
LEFT JOIN deviceinfo ON (deviceinfo.id = sessions.deviceid)WHERE
sessions.start_time BETWEEN '2017-09-01' AND '2017-11-30' ) as s
ON s.deviceid = u.id GROUP BY u.cohort ) as tb
LEFT JOIN ( SELECT DATE_FORMAT(created_at, '%Y-%m-%d') dt,
COUNT(*) size FROM deviceinfo GROUP BY dt ) size ON tb.cohort = size.dt
以上内容适用于Apache 2.4,其中Order
, Allow
, and Deny
are deprecated。