slackware下apache安装、反向代理配置

0.环境

slackware 14.0 64位

apche httpd-2.4.7

1.安装

1.1.下载apache最新包

httpd-2.4.7.tar.bz2

1.2.安装

# tar zxvf httpd-2.4.7.tar.bz2

# cd httpd-2.4.7

# ./configure --enable-dav --enable-so --enable-maintainer-mode --enable-rewrite --enable-deflate=shared --enable-ssl=shared --enable-expires=shared --enable-headers=shared --enable-static-support --enable-cache --enable-file-cache --with-mpm=prefork --enable-mods-shared=all

注意:关键选项--with-mpm=prefork --enable-mods-shared=all

1.3.配置

默认安装路径为/usr/local/apache2

配置文件为/usr/local/apache2/conf/httpd.conf

1.4.关键配置项

# vim /usr/local/apache2/conf/httpd.conf

ServerName "/etc/httpd"

指定运行配置路径为/etc/httpd(安装路径为/usr/local/apache2),正常应该为安装路径/usr/local/apache2。

需要将conf和modules拷贝到运行配置路径/etc/httpd下面,并建立日志路径logs。如果为安装路径,则不需要本步骤操作。

# cp -R /usr/local/apache2/conf /etc/httpd

# cp -R /usr/local/apache2/modules /etc/httpd

# mkdir /etc/httpd/logs

1.5.在运行配置路径/etc/httpd的conf的extra下面新建文件httpd-svn.conf

# vim /etc/httpd/conf/extra/httpd-svn.conf

<VirtualHost *:port>
    #The reverse proxy settings
    ProxyPreserveHost On
    ProxyPass /svn http://xxx.xxx.xxx.xxx:port/svn
    ProxyPassReverse /svn http://xxx.xxx.xxx.xxx:port/svn
</VirtualHost>

第一个VirtualHost的port为访问时用到的端口,

第二个http的port为反向代理服务器的端口;

1.6.在安装路径/usr/loacl/apache的conf下面修改主配置文件httpd.conf

# vim /usr/local/apache2/conf/httpd.conf

1.6.1.引入proxy相关module

找到下面行,取消注释。

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so

1.6.2.增加监听端口

在Listen 80下增加行,新增访问端口监听(假设端口号为9999)。

Listen 80
Listen 9999

1.7.其他

拷贝在安装路径/usr/loacl/apache的bin下面的httpd,到/usr/sbin下面。

# cp /usr/local/apache2/bin/httpd /usr/sbin

1.8.查看apache版本、安装等详细信息

# httpd -v

# httpd -V

# httpd -l

1.9.查看apache是否运行

# ps -aux | grep httpd

1.10.apache启动、停止、重启

# /usr/local/apache2/bin/apachectl start

# /usr/local/apache2/bin/apachectl stop

# /usr/local/apache2/bin/apachectl restart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值