httpd 配置 webdav 和反向代理服务器

网上搜了很多教程,也配置了很多次,每次也都稀里糊涂配成功了,有在 Ubuntu 和 Centos,也有 Debian 的,至今搞不清 httpd 和 apache2 区别,偶然配置成功了,做下笔记 ...

手头上有个 Debian 8 的服务器,自带了 httpd,但是浏览器输出的 Header 消息显示 Server 是 Apache/2.4.6 (CentOS),一脸懵逼 ...

WebDav 设置

这是 httpd,在 /etc 下有个 httpd 的目录,目录结构如下:

httpd 配置 webdav 和反向代理服务器_第1张图片
/etc/httpd

apache 好像有 site-enabled 和 site-available 两个文件夹,二脸懵逼。

在 http.conf 文件最后一行,有 IncludeOptional conf.d/*.conf 这一句指令,那么我们只需要把 conf 配置写到 conf.d 这个文件夹下就行了。

启用 webdav 之前,保证下列模块已经加载:mod_dav.so,mod_dav_fs.so,mod_dav_lock.so,mod_auth*.so

配置文件内容如下:


ServerAdmin [email protected]
DocumentRoot "/home/webdav"
ServerName xx.xx.xx
ServerAlias xx.xx.xx
DAVLockDB /var/www/web/DavLock
  
    Dav On
    Options Indexes FollowSymLinks Includes
    Order Allow,Deny  
    Allow from all  
    AllowOverride None  
    #AuthType Digest  
    AuthType Basic  
    AuthName WebDAV-Server  
    #You can use the htdigest program to create the password database:  
    #htdigest -c "/tmp/mips/user.passwd" DAV-upload admin  
    #htpasswd -c "/tmp/mips/user.passwd" admin  
    AuthUserFile "/var/httpd-users"  
    #AuthDigestProvider file  
    AuthBasicProvider file
    require user xuzhi


需要注意的是,目录 /home/webdav 和 文件 /var/www/web/DavLock 最好都设置 777 属性,设置用户和用户组为 apache:apache,可以参考默认文件夹 /var/www/html 的属性。

反向代理设置

代理设置就相对简单了,配置文件如下:


ServerAdmin [email protected]
ServerName xx.xx.xx
ServerAlias xx.xx.xx
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/

普通 Web 静态服务器

也不是太复杂,反正关闭了 ssh 密码登录,索性都用 chmod 777 -R /home/dc 和 chown apache:apache -R /home/dc 设置了一番。


ServerAdmin [email protected]
DocumentRoot "/home/dc"
ServerName xx.xx.me
ServerAlias xx.xx.me

    AllowOverride None
    Require all granted


当然线上环境切不可如此,这里纯粹图方便。

你可能感兴趣的:(httpd 配置 webdav 和反向代理服务器)