我需要在我的 Debian 7 服务器上运行 Apache2。但它只能在 tcpv6 端口上运行,而不能在 tcpv4 端口上运行。我用 apt-get install 安装了它。如果我访问 localhost 或 127.0.0.1 或我的服务器 IPv4 地址,它不会显示任何网站。
我的/etc/apache2/ports.conf:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost …Run Code Online (Sandbox Code Playgroud) 我使用 logrotate 来轮换 Apache 访问、错误和重写日志。我的配置文件如下所示:
/apache/*log {
compress
dateext
rotate 365
size=+300M
olddir /log/old/apache
notifempty
missingok
lastaction
/bin/apache reload
endscript
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,每当发生轮换时,都必须重新加载 Apache,因为 Apache 不会在刚刚轮换的日志文件中写入任何内容。有没有办法避免每次 logrotate 进行轮换时 Apache 重新加载?
我需要 CentOS 中的 Apache 2.4,因为 Apache 2.2mod_proxy_wstunnel是不可能的。我试过这个,但不幸的是它用于 RHEL。安装后,我无法执行Apache 2.4。
谁能告诉我如何在 CentOS 中安装一个完整的 Apache 2.4?
编辑:
# yum list installed | grep httpd
Failed to set locale, defaulting to C
httpd.x86_64 2.2.15-30.el6.centos @updates
httpd-tools.x86_64 2.2.15-30.el6.centos @updates
httpd24.x86_64 1-6.el6 @epel-httpd24
httpd24-apr.x86_64 1.4.8-2.el6 @epel-httpd24
httpd24-apr-util.x86_64 1.5.2-5.el6 @epel-httpd24
httpd24-httpd.x86_64 2.4.6-5.el6 @epel-httpd24
httpd24-httpd-tools.x86_64 2.4.6-5.el6 @epel-httpd24
httpd24-mod_ssl.x86_64 1:2.4.6-5.el6 @epel-httpd24
httpd24-runtime.x86_64 1-6.el6 @epel-httpd24
Run Code Online (Sandbox Code Playgroud) 我正在运行 Apache2 版本:
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2018-04-25T11:38:24
Run Code Online (Sandbox Code Playgroud)
我想使TLSv1.3,但我得到一个错误在下面的Apache2,如果我把SSLProtocol TLSv1.2 TLSv1.3中ssl.conf文件:
# apachectl configtest
AH00526: Syntax error on line 79 of /etc/apache2/mods-enabled/ssl.conf:
SSLProtocol: Illegal protocol 'TLSv1.3'
Action 'configtest' failed.
The Apache error log may have more information.
Run Code Online (Sandbox Code Playgroud)
是否无法在 Apache2 中启用 TLSv1.3(还)?
我知道 Nginx 可以做到,但是这个问题针对的是 Apache2。
httpd( Apache/2.2.29) 内存使用有一些问题。
随着时间的推移,httpd进程中的内存使用量会逐渐增加,直到最终达到 100%。
我上次重新启动httpd是在大约 24 小时前。输出free -m是:
[ec2-user@www ~]$ free -m
total used free shared buffers cached
Mem: 1655 1415 239 0 202 424
-/+ buffers/cache: 788 866
Swap: 1023 4 1019
Run Code Online (Sandbox Code Playgroud)
为了证明它肯定是httpd,我重新启动httpd并free -m再次运行:
[ec2-user@www ~]$ sudo service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[ec2-user@www ~]$ free -m
total used free shared buffers cached
Mem: 1655 760 894 …Run Code Online (Sandbox Code Playgroud) 我有一个CentOS Linux release 7.1.1503 (Core)系统,我已经安装好httpd了,对应的配置文件是:
#
# This is the main rConfig Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 60
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild …Run Code Online (Sandbox Code Playgroud) 在我的 Debian 机器上,apache2 的当前版本是 2.4.10:
root@9dd0fd95a309:/# apachectl -V
Server version: Apache/2.4.10 (Debian)
Run Code Online (Sandbox Code Playgroud)
我想将 apache 升级到最新版本(至少 2.4.26):我尝试过:
root@9dd0fd95a309:/# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
apache2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 48 not upgraded.
Run Code Online (Sandbox Code Playgroud)
但它没有找到任何更新。我该怎么做才能升级到最新版本?
我正在努力使 Wordpress 工作。我目前有此错误消息:
Could not create directory. /var/www/html/wp-content/upgrade/theme_name
Run Code Online (Sandbox Code Playgroud)
尝试上传主题时。这是权限设置为/var/www/html/wp-content/upgrade/
drwxrwxr-x 3 ec2-user apache 4096 Jun 21 00:30 upgrade
Run Code Online (Sandbox Code Playgroud)
chmod 777 upgrade使错误消失。但这不被认为是最佳实践。但是,我认为这也应该有效......为什么不呢?
我猜上述权限可能不包含 Web 服务器。我应该使用哪个组来允许 Web 服务器写入?
(我的设置是 Amazon EC2、Amazon Linux AMI with httpd)
我正在尝试在我的虚拟机上的 CentOS 6.5 中打开端口 80,以便我可以从桌面浏览器访问 apache。

如果你看看上面的截图......我已经在蓝色箭头之前添加了一行,正如http://www.cyberciti.biz/faq/linux-iptables-firewall-open-port- 80/ 现在我在浏览器中输入 IP 地址时确实获得了 apache 测试页面,但是在重新启动 iptables 时,当 CentOS 尝试应用新规则时,我仍然收到“FAILED”。
有谁知道解决方案?还是我需要忽略失败?
我们的一台小型服务器上很少需要 apache httpd 服务器,因此最好通过 systemd 通过套接字激活来启动它(然后在一段时间没有流量发生时将其停止)。这是可能的,如果是,如何?
apache-httpd ×10
centos ×3
debian ×2
chmod ×1
iptables ×1
logrotate ×1
memory ×1
permissions ×1
repository ×1
ssl ×1
systemd ×1
yum ×1