为实现跳转,Linux下安装apache以及配置

    技术2022-05-20  56

    一:安装篇

    1:安装linux操作系统

    2:在图形界面下下载apache 安装包,我下的是 httpd-2.2.17.tar.gz 源码安装包,地址是http://httpd.apache.org/download.cgi3:将下载文件保存到/software/apache 目录下,也可以自己建立其他的文件夹保存。用:gzip -d httpd-2.2.17.tar.gztar xvf httpd-2.2.17.tar解压安装包,之后会出现 httpd2.2.17 的文件夹,进入该文件夹。4:在httpd-2.2.17文件夹下可以看到configure 的文件夹,此时用:./configure --prefix=/usr/local/apache --enable-so 设置安装目录和参数设置命令so模块是用来提DSO支持的apache核心模块,这里设置启动5:用make 和make install 编译安装apache 就可以了6:/usr/local/apache/bin/apachectl start ,该命令用来启用apache。

     

    二:配置篇

    --编译第三方包   --切换httpd-2.2.17目录   cd /opt/aspire/product/mosp/httpd-2.2.17/modules/proxy     --用刚装好的apache/bin/apxs工具生成so文件   /opt/aspire/product/mosp/apache/bin/apxs -c -n -i mod_proxy.c proxy_util.c   /opt/aspire/product/mosp/apache/bin/apxs -c -n -i mod_proxy_http.c proxy_util.c   /opt/aspire/product/mosp/apache/bin/apxs -c -n -i mod_proxy_ftp.c proxy_util.c   /opt/aspire/product/mosp/apache/bin/apxs -c -n -i mod_proxy_connect.c proxy_util.c   /opt/aspire/product/mosp/apache/bin/apxs -c -n -i mod_proxy_balancer.c proxy_util.c   /opt/aspire/product/mosp/apache/bin/apxs -c -n -i mod_proxy_ajp.c ajp*.c     --在mod_fileiri.c的目录下执行   /opt/aspire/product/mosp/apache/bin/apxs -c -n -i mod_fileiri.c     --切换在/httpd-2.2.17/modules/proxy目录中会生成隐藏目录.libs   cd .libs     --复制生成好的 .so 文件到 apache/modules/   cp *.so /opt/aspire/product/mosp/apache/modules/   

    第二步就是配置 httpd.conf

    LoadModule proxy_module       modules/mod_proxy.so

    LoadModule proxy_http_module  modules/mod_proxy_http.so

    LoadModule authz_host_module modules/mod_authz_host.so

    #LoadModule proxy_ajp_module   modules/mod_proxy_ajp.so

    LoadModule rewrite_module     modules/mod_rewrite.so

    LoadModule proxy_connect_module modules/mod_proxy_connect.so

     

    <IfModule rewrite_module>

        RewriteEngine on

        RewriteLog "logs/rewrite.log"

        #ProxyRequests on

        RewriteRule ^/$ http://%{SERVER_NAME}:7500/sms [P]

    </IfModule>

     

    启动时,如果发现80端口被占,

    netstat -tlnp|grep 80 查杀

    参考如下:

    1.一进程确定占用某一tcp端口,如下命令可以杀掉该进程。 netstat -tlnp|grep port

     

    kill -9 $(netstat -tlnp|grep 1099|awk '{print $7}'|awk -F '/' '{print $1}')

     

    最后测试,输入http://172.20.32.40 成功跳转到http://172.20.32.40:7500/sms/

    不过输入http://safety.ceair.com/ 域名

    出现

    Proxy Error

    The proxy server received an invalid response from an upstream server.The proxy server could not handle the request GET /.

    Reason: DNS lookup failure for: safety.ceair.com

     

    还有待解决


    最新回复(0)