apache - httpd 2.4 支持 PUT 和 GET 吗?

标签 apache centos httpd.conf

我已经在 CentOS 7 机器上安装了 httpd-2.4.6-89.el7.centos.x86_64 并配置了一个网络服务器,但是我无法让 http 'PUT/POST' 或 'GET' 工作

下面提到的是我的配置

[root@centos-007 httpd]# cat /etc/httpd/conf.d/centos-007.conf
<VirtualHost *:80>
    ServerName centos-007.gg.com
    DocumentRoot "/abc/xyz"
        DirectoryIndex index.html
        <Location />
        Require all granted
        Options +Indexes
        </Location>
    Alias /avaya  "/abc/xyz"
    <Directory "/abc/xyz">
    Require all granted
    Dav On
    <LimitExcept GET POST OPTIONS>
    </LimitExcept>
    Options FollowSymLinks Indexes MultiViews
    </Directory>
</VirtualHost>
<VirtualHost *:80>
    ServerName centos-007
    DocumentRoot /var/www/centos-007/pub_html
    <Directory /var/www/centos-007/pub_html>
    Options Indexes FollowSymLinks MultiViews
    Require all granted
    </Directory>
</VirtualHost>

奇怪的是,当我运行 curl 命令上传文件时,我得到以下信息,但是网页没有显示上传的文件
* About to connect() to centos-007.gg.com port 80 (#0)
*   Trying 10.170.110.100...
* Connected to centos-007.gg.com (10.170.110.100) port 80 (#0)
> PUT /avaya HTTP/1.1
> User-Agent: curl/7.29.0
> Host: centos-007.gg.com
> Accept: */*
> Content-Length: 824
> Expect: 100-continue
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 18 Jun 2019 13:25:54 GMT
< Server: Apache/2.4.6 (CentOS)
< Location: http://centos-007.wsgc.com/xyx
< Content-Length: 245
< Connection: close
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="http://centos-007.gg.com/xyx">here</a>.</p>
</body></html>
* Closing connection 0

最佳答案

我可以使用底层来完成这项工作

DavLockDB /var/www/html/DavLock
<VirtualHost *:80>
    ServerName centos-007.gg.com 
    DocumentRoot /abc/xyz
<Location />
    Require all granted
    Options +Indexes
</Location>
    ErrorLog /var/log/httpd/error.log
    CustomLog /var/log/httpd/access.log combined
    Alias /xyz  /abc/xyz
    <Directory  /abc/xyz>
        Require all granted
        DAV On
        AuthType Basic
        Require valid-user
    </Directory>
</VirtualHost>

关于apache - httpd 2.4 支持 PUT 和 GET 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56650619/

相关文章:

apache - 加载资源失败:使用 Apache 2.4 和 Chrome 的 net::ERR_CONNECTION_RESET

apache - 从favicon.ico删除Etag

apache - 重写规则上的静态文本

bash - 如何在邮件命令中同时使用 html 和纯文本标题?

centos - 如何在 centos 中更改/升级我的 GLIBCXX

sql-server - PHP警告: PHP Startup: Unable to load dynamic library 'C:\\Users\\Public\\xampp\\php\\ext\\php_sqlsrv_56_ts.dll'

PHP sendmail 在 Ubuntu 命令行中工作,但不能从 php 文件中工作

xml - Tomcat 5.5 - 你如何将 "unpackWARs"到/webapps 以外的位置?

nginx - CentOS 安装 nginx 失败

Apache 不会在 httpd.conf 中的路径名中以空格开头(即使带引号)