标签: apache-httpd

apache2 无效命令“SSLEngine”

当我重新启动 httpd 时,出现以下错误。我错过了什么?

[root@localhost ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: Syntax error on line 22 of /etc/httpd/conf.d/sites.conf:
Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
Run Code Online (Sandbox Code Playgroud)

我已经使用安装了 mod_ssl yum install mod_ssl openssh

Package 1:mod_ssl-2.2.15-15.el6.centos.x86_64 already installed and latest version
Package openssh-5.3p1-70.el6_2.2.x86_64 already installed and latest version
Run Code Online (Sandbox Code Playgroud)

我的sites.conf 看起来像这样

<VirtualHost *:80>
#    ServerName shop.itmanx.com
    ServerAdmin webmaster@itmanx.com

    DocumentRoot /var/www/html/magento
    <Directory /var/www/html>
        Options -Indexes
        AllowOverride All
    </Directory>

    ErrorLog logs/shop-error.log
    CustomLog logs/shop-access.log …
Run Code Online (Sandbox Code Playgroud)

ssl apache-httpd

133
推荐指数
4
解决办法
33万
查看次数

如何知道我正在运行的 apache 版本?

我知道这phpinfo()条路,但还有其他办法吗?我正在使用 CentOS,但找不到httpd要运行的可执行文件httpd -v

version centos apache-httpd

81
推荐指数
5
解决办法
26万
查看次数

如何在 Apache 中禁用 SSLv3?

今天似乎每个人都在谈论POODLE 漏洞。每个人都建议使用以下配置指令在 Apache 中禁用 SSLv3:

SSLProtocol All -SSLv2 -SSLv3
Run Code Online (Sandbox Code Playgroud)

而不是默认

SSLProtocol All -SSLv2
Run Code Online (Sandbox Code Playgroud)

我已经这样做了,但并不高兴 – 在使用各种工具(这里是一个快速工具)反复测试之后,我发现 SSLv3 很高兴地被我的服务器接受了。

是的,我确实重新启动了 Apache。是的,我grep对所有配置文件进行了递归,并且在任何地方都没有任何覆盖。不,我没有使用某些古老版本的 Apache:

[root@server ~]# apachectl -v
Server version: Apache/2.2.15 (Unix)
Server built:   Jul 23 2014 14:17:29
Run Code Online (Sandbox Code Playgroud)

那么,什么给?如何在 Apache 中真正禁用 SSLv3?

ssl apache-httpd

77
推荐指数
2
解决办法
15万
查看次数

您在 Apache 2 中的何处全局设置 ServerName 指令?

注意:这与我的问题有关:“ Apache 2.4 不会重新加载,我的配置有问题吗? ”。

我正在尝试在本地测试本地站点。据我了解,Apache 2(也许还有 Apache)有一个叫做VirtualHost. 我的一点理解告诉我,虚拟主机是一种服务器/IP 地址可以为多个域提供服务的方式。

无论如何,我在运行 Apache 2configtest以查看失败的地方时遇到以下错误。我正在运行 Apache 2.4.10-1,似乎 Apache 2.2 和 Apache 2.4 之间发生了很多我不知道的更改。

$ sudo apache2ctl configtest
[sudo] password for shirish:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Run Code Online (Sandbox Code Playgroud)

这是/etc/hosts文件:

 $ cat /etc/hosts
127.0.0.1    localhost
127.0.1.1    debian mini
Run Code Online (Sandbox Code Playgroud)

我也看到一个空/etc/hosts.conf文件。也许里面的数据/etc/hosts需要复制到/etc/hosts.conf服务器才能识别?

我的主机名: …

debian configuration apache-httpd

52
推荐指数
3
解决办法
23万
查看次数

配置:错误:C 编译器无法创建可执行文件

我正在尝试将 apache 2.2.15 升级到 2.2.27。在运行从 apache2.2.15/build 获取的 config.nice 时,我收到以下错误:

checking whether the C compiler works... no
configure: error: in `/home/vkuser/httpd-2.2.27/srclib/apr':
configure: error: C compiler cannot create executables
Run Code Online (Sandbox Code Playgroud)

我试图在网上搜索但没有运气。我还通过运行一个小的 test.c 脚本测试了 c 编译器,它运行良好。在线提供的解决方案很少,例如安装“kernel-devel”软件包,但没有解决问题。我怎样才能让它发挥作用?

以下是生成的 config.log:

    This file contains any messages produced by compilers while
    running configure, to aid debugging if configure makes a mistake.

    It was created by configure, which was
    generated by GNU Autoconf 2.67.  Invocation command line was

      $ ./configure --prefix=/opt/myapp/apache2.2 --with-mpm=worker --enable-static-support --enable-ssl=static --enable-modules=most --disable-authndbd --disable-authn-dbm --disable-dbd --enable-static-logresolve …
Run Code Online (Sandbox Code Playgroud)

compiling gcc 32bit apache-httpd

46
推荐指数
2
解决办法
20万
查看次数

apache 和 PHP 应该以什么用户身份运行?/var/www 文件应该有什么权限?

我刚刚启动了一个 Ubuntu 11.10 盒子,然后跑去apt-get install apache2 php5在盒子上安装 apache2 和 PHP 5。现在它作为一个“网络服务器”运行并加载“It Works!” 页。现在我正在努力加强安全性,我对 linux web 服务器有以下问题:

  1. apache 应该以谁的身份运行?
  2. 该用户应该属于哪个组?
  3. 哪些包可以使 PHP(和 Apache?)作为文件的所有者运行?(比如在共享网络主机上)我应该使用这些包吗?在小型系统上维护它们是否容易/可行?
  4. 对于以 apache 运行的方式提供给网络的文件和文件夹的默认权限应该是什么www-data?对于以用户身份运行的 apache/php?

我在检查默认设置时做了以下事情:

文件结构

当我cd /和做ls -al的内容列表,我看到/var

drwxr-xr-x 13 root root  4096 2012-02-04 20:47 var/
Run Code Online (Sandbox Code Playgroud)

如果我cd进入var并且确实ls -al看到:

drwxr-xr-x  2 root root  4096 2012-02-04 20:47 www/
Run Code Online (Sandbox Code Playgroud)

最后,在里面/var/www我看到:

drwxr-xr-x  2 root root 4096 2012-02-04 20:47 ./
drwxr-xr-x 13 root root …
Run Code Online (Sandbox Code Playgroud)

linux security users php apache-httpd

43
推荐指数
2
解决办法
14万
查看次数

由于 SELinux,httpd 无法写入文件夹/文件

有谁知道哪个 sebool 允许 httpd 对 /home/user/html 进行写访问?当我禁用SELinux时echo 0 > /selinux/enforce我可以写,所以我的问题肯定与SELinux有关。我只是不知道哪个是正确的而不打开一个大洞,而谷歌也没有太大帮助。

#[/home]ls -Z
drwxr-x---. user       apache     unconfined_u:object_r:user_home_dir_t:s0 user

#sestatus -b
Policy booleans:
abrt_anon_write                             off
abrt_handle_event                           off
allow_console_login                         on
allow_cvs_read_shadow                       off
allow_daemons_dump_core                     on
allow_daemons_use_tcp_wrapper               off
allow_daemons_use_tty                       on
allow_domain_fd_use                         on
allow_execheap                              off
allow_execmem                               on
allow_execmod                               on
allow_execstack                             on
allow_ftpd_anon_write                       off
allow_ftpd_full_access                      off
allow_ftpd_use_cifs                         off
allow_ftpd_use_nfs                          off
allow_gssd_read_tmp                         on
allow_guest_exec_content                    off
allow_httpd_anon_write                      off
allow_httpd_mod_auth_ntlm_winbind           off
allow_httpd_mod_auth_pam                    off
allow_httpd_sys_script_anon_write           off
allow_java_execstack                        off
allow_kerberos                              on
allow_mount_anyfile                         on
allow_mplayer_execstack                     off
allow_nsplugin_execmem                      on
allow_polyinstantiation                     off
allow_postfix_local_write_mail_spool …
Run Code Online (Sandbox Code Playgroud)

selinux apache-httpd

39
推荐指数
2
解决办法
12万
查看次数

更改 Apache httpd "Server:" HTTP 标头

Apachehttpd与响应数据一起发回的 HTTP 标头之一是“服务器”。例如,我的 Web 服务器机器是相对最新的 Arch Linux。它发送回与以下内容非常相似的标头:

HTTP/1.1 404 Not Found
Date: Thu, 10 Apr 2014 17:19:27 GMT
Server: Apache/2.4.9 (Unix)
Content-Length: 1149
Connection: close
Content-Type: text/html
Run Code Online (Sandbox Code Playgroud)

ServerSignature off/etc/httpd/conf/httpd.conf,但“服务器:”字段仍然出现。我已经尝试过mod_headers。我启用了它,并且尝试了一些操作:

<IfModule headers_module>
Header set ProcessingTime "%D"
Header set Server BigJohn
</IfModule>
Run Code Online (Sandbox Code Playgroud)

停止并启动httpd上述配置后,HTTP 标头包含类似 的内容ProcessingTime: 1523,但“Server:”标头行保持不变。所以我知道“mod_headers”已安装并启用,并且可以正常工作,但不是我想要的。

我看到一个叫做“mod_security”的东西声称可以做到这一点,但我不想要 mod_security 携带的所有其他包袱。

更新:

一旦你mod_security安装,你只需要几个指令:

<IfModule security2_module>
SecRuleEngine on
ServerTokens Full
SecServerSignature "Microsoft-IIS/6.0"
</IfModule>
Run Code Online (Sandbox Code Playgroud)

这是mod_security2.7.7

http apache-httpd

37
推荐指数
3
解决办法
11万
查看次数

“不允许符号链接或链接目标不可访问”/ CentOS 6 上的 Apache

我有一个全新的 CentOS 6 安装,它在文档根目录中有一个指向我的开发文件的符号链接:

[root@localhost html]# ls -l
total 4
-rwxrwxrwx. 1 root root  0 Sep 18 20:16 index.html
-rwxrwxrwx. 1 root root 17 Sep 18 20:16 index.php
lrwxrwxrwx. 1 root root 24 Sep 18 20:19 refresh-app -> /home/billy/refresh-app/
Run Code Online (Sandbox Code Playgroud)

我的 httpd.conf 有这个:

<Directory "/">
    Options All
    AllowOverride None
    Order allow,deny
    Allow from all
</directory>
Run Code Online (Sandbox Code Playgroud)

符号链接的目标具有允许 apache 读取它想要的任何内容的权限:

 [root@localhost billy]# ls -l
total 40 (Some entries were omitted because the list was too long
drwxr-xr-x. 7 billy billy 4096 Sep 18 …
Run Code Online (Sandbox Code Playgroud)

permissions centos apache-httpd

35
推荐指数
3
解决办法
15万
查看次数

Apache SSL:服务器证书不包含与服务器名称匹配的 ID

我正在尝试在我的 apache2 网络服务器上设置 SSL,但它似乎根本不起作用。

我已经按照教程使用 openssl 创建证书文件并/etc/apache2/sites-available/default-ssl.conf正确配置。

每次我尝试使用 https 打开我的网站时,由于安全问题,我的浏览器拒绝连接。它说我没有正确配置我的网站。

在我的/var/log/apache2/error.log我收到警告,说我的服务器证书不包含与服务器名称匹配的 ID。

[Mon Apr 10 11:03:24.041813 2017] [mpm_prefork:notice] [pid 1222] AH00169: caught SIGTERM, shutting down
[Mon Apr 10 11:03:30.566578 2017] [ssl:warn] [pid 661] AH01909: 127.0.0.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Apr 10 11:03:31.579088 2017] [ssl:warn] [pid 1194] AH01909: 127.0.0.1:443:0 server certificate does NOT include an ID which matches the server name
[Mon Apr 10 11:03:31.592958 2017] [mpm_prefork:notice] [pid …
Run Code Online (Sandbox Code Playgroud)

webserver ssl openssl https apache-httpd

32
推荐指数
2
解决办法
15万
查看次数