linux下安装apache的及反向代理配置完整过程.docx

上传人:b****1 文档编号:1218803 上传时间:2023-04-30 格式:DOCX 页数:22 大小:22.55KB
下载 相关 举报
linux下安装apache的及反向代理配置完整过程.docx_第1页
第1页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第2页
第2页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第3页
第3页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第4页
第4页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第5页
第5页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第6页
第6页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第7页
第7页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第8页
第8页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第9页
第9页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第10页
第10页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第11页
第11页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第12页
第12页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第13页
第13页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第14页
第14页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第15页
第15页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第16页
第16页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第17页
第17页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第18页
第18页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第19页
第19页 / 共22页
linux下安装apache的及反向代理配置完整过程.docx_第20页
第20页 / 共22页
亲,该文档总共22页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

linux下安装apache的及反向代理配置完整过程.docx

《linux下安装apache的及反向代理配置完整过程.docx》由会员分享,可在线阅读,更多相关《linux下安装apache的及反向代理配置完整过程.docx(22页珍藏版)》请在冰点文库上搜索。

linux下安装apache的及反向代理配置完整过程.docx

linux下安装apache的及反向代理配置完整过程

下面是linux下安装apache的完整代码,系统是redhat5.5

1、检查系统防火墙有没开,需要把防火墙关掉,可以执行SETUP查看,关闭。

在开启了防火墙时,做如下设置,开启相关端口,

修改/etc/sysconfig/iptables文件,添加以下内容:

-ARH-Firewall-1-INPUT-mstate--stateNEW-mtcp-ptcp--dport80-jACCEPT

-ARH-Firewall-1-INPUT-mstate--stateNEW-mtcp-ptcp--dport8088-jACCEPT

2、安装Apache

下载地址:

//httpd.apache.org/>

1.安装Apache

#tarzxvfhttpd-2.2.22.tar.gz//解压文件

#cdhttpd-2.2.22//进入安装文件夹

#./configure--prefix=/usr/local/apache--enable-so--enable-mods-shared=most--enable-proxy--enable-proxy-connect--enable-proxy-ftp--enable-proxy-http--enable-proxy-scgi--enable-proxy-ajp--enable-proxy-balancer//配置apache路径加载动态模块

#make//编译apache

#makeinstall//安装apache

其它相关命令:

下载httpd-2.2.22.tar.bz2把httpd-2.2.22.tar.bz2放到/soft下

[root@localhost~]#cd/soft

[root@localhostsoft]#tarjxvfhttpd-2.2.6.tar.bz2//解压apache的压缩包

[root@localhostsoft]#cdhttpd-2.2.6//定位到httpd-2.2.6文件夹下

[root@localhosthttpd-2.2.6]#ls//查看显示httpd-2.2.6文件夹下内容

[root@localhosthttpd-2.2.6]#./configure--help|more//查看安装apache配置参数

[root@localhosthttpd-2.2.6]#./configure--prefix=/usr/local/apache--enable-so//配置apache路径

[root@localhosthttpd-2.2.6]#./configure--prefix=/usr/local/apache--enable-so--enable-mods-shared=most--enable-proxy--enable-proxy-connect--enable-proxy-ftp--enable-proxy-http--enable-proxy-scgi--enable-proxy-ajp--enable-proxy-balancer//配置apache路径加载动态模块

[root@localhosthttpd-2.2.6]#make//编译apache

[root@localhosthttpd-2.2.6]#makeinstall//安装apache

[root@localhosthttpd-2.2.6]#cd/usr/local/apache//进入apache的目录

[root@localhostapache]#cdconf/

[root@localhostconf]#cphttpd.confhttpd.conf_bak//备份apache配置文件

[root@localhostconf]#chkconfig--listhttpd//查看httpd服务是否已存在

[root@localhostconf]#chkconfighttpdoff//关闭系统自带了httpd的服务,如果存在httpd服务

[root@localhostconf]#servicehttpdstatus//查看自带httpd服务状态

[root@localhostconf]#/usr/local/apache/bin/apachectl-kstart//linux启动apache命令

[root@localhostconf]#/usr/local/apache/bin/apachectl-kstop//linux停止apache命令

[root@localhostconf]#netstat-an|grep:

80//查看linux80端口是否开启

[root@localhostconf]#ps-aux|grephttpd//linux下查看apache进程

[root@localhostconf]#cd../..

[root@localhostlocal]#cp/usr/local/apache/bin/apachectl/etc/rc.d/init.d/apache//拷贝apache启动脚本

[root@localhostlocal]#vi/etc/rc.d/init.d/apache//这里是编辑apache启动脚本

在开头的#!

/bin/sh下面加上

#chkconfig:

23458515

[root@localhostlocal]#chkconfig--addapache//添加apache服务

[root@localhostlocal]#chkconfig--listapache//列出apache服务

[root@localhostlocal]#serviceapachestop//停止apache服务

[root@localhostlocal]#netstat-an|grep:

80//查看linux的80端口是否开启

[root@localhostlocal]#ps-aux|grephttpd//查看是否存在httpd服务,若果之前自带httpd服务启动的话会导致新添加的apache服务启动失败

[root@localhostlocal]#serviceapachestart//启动apache服务

打开你的服务器ip地址,看看是否出现了tomcat的默认首页,如果出现的话,那么恭喜你

linux下安装apache已经成功了

3、修改httpd.conf文件

vi/usr/local/apache/conf/httpd.conf

以下为httpd.conf内容:

#ThisisthemainApacheHTTPserverconfigurationfile.Itcontainsthe

#configurationdirectivesthatgivetheserveritsinstructions.

#See

http:

//httpd.apache.org/docs/2.2>fordetailedinformation.

#Inparticular,see

#

http:

//httpd.apache.org/docs/2.2/mod/directives.html>

#foradiscussionofeachconfigurationdirective.

#

#DoNOTsimplyreadtheinstructionsinherewithoutunderstanding

#whattheydo.They'rehereonlyashintsorreminders.Ifyouareunsure

#consulttheonlinedocs.Youhavebeenwarned.

#

#Configurationandlogfilenames:

Ifthefilenamesyouspecifyformany

#oftheserver'scontrolfilesbeginwith"/"(or"drive:

/"forWin32),the

#serverwillusethatexplicitpath.Ifthefilenamesdo*not*begin

#with"/",thevalueofServerRootisprepended--so"logs/foo_log"

#withServerRootsetto"/usr/local/apache"willbeinterpretedbythe

#serveras"/usr/local/apache/logs/foo_log".

#

#ServerRoot:

Thetopofthedirectorytreeunderwhichtheserver's

#configuration,error,andlogfilesarekept.

#

#Donotaddaslashattheendofthedirectorypath.Ifyoupoint

#ServerRootatanon-localdisk,besuretopointtheLockFiledirective

#atalocaldisk.IfyouwishtosharethesameServerRootformultiple

#httpddaemons,youwillneedtochangeatleastLockFileandPidFile.

#

ServerRoot"/usr/local/apache"

#

#Listen:

AllowsyoutobindApachetospecificIPaddressesand/or

#ports,insteadofthedefault.Seealsothe

#directive.

#

#ChangethistoListenonspecificIPaddressesasshownbelowto

#preventApachefromglommingontoallboundIPaddresses.

#

#Listen12.34.56.78:

80

Listen80

Listen8088--增加监听端口

#

#DynamicSharedObject(DSO)Support

#

#TobeabletousethefunctionalityofamodulewhichwasbuiltasaDSOyou

#havetoplacecorresponding`LoadModule'linesatthislocationsothe

#directivescontainedinitareactuallyavailable_before_theyareused.

#Staticallycompiledmodules(thoselistedby`httpd-l')donotneed

#tobeloadedhere.

#

#Example:

#LoadModulefoo_modulemodules/mod_foo.so

#

LoadModuleauthn_file_modulemodules/mod_authn_file.so--加载的模块,正确安装完会自动加载以下模块

LoadModuleauthn_dbm_modulemodules/mod_authn_dbm.so

LoadModuleauthn_anon_modulemodules/mod_authn_anon.so

LoadModuleauthn_dbd_modulemodules/mod_authn_dbd.so

LoadModuleauthn_default_modulemodules/mod_authn_default.so

LoadModuleauthz_host_modulemodules/mod_authz_host.so

LoadModuleauthz_groupfile_modulemodules/mod_authz_groupfile.so

LoadModuleauthz_user_modulemodules/mod_authz_user.so

LoadModuleauthz_dbm_modulemodules/mod_authz_dbm.so

LoadModuleauthz_owner_modulemodules/mod_authz_owner.so

LoadModuleauthz_default_modulemodules/mod_authz_default.so

LoadModuleauth_basic_modulemodules/mod_auth_basic.so

LoadModuleauth_digest_modulemodules/mod_auth_digest.so

LoadModuledbd_modulemodules/mod_dbd.so

LoadModuledumpio_modulemodules/mod_dumpio.so

LoadModulereqtimeout_modulemodules/mod_reqtimeout.so

LoadModuleext_filter_modulemodules/mod_ext_filter.so

LoadModuleinclude_modulemodules/mod_include.so

LoadModulefilter_modulemodules/mod_filter.so

LoadModulesubstitute_modulemodules/mod_substitute.so

LoadModuledeflate_modulemodules/mod_deflate.so

LoadModulelog_config_modulemodules/mod_log_config.so

LoadModulelogio_modulemodules/mod_logio.so

LoadModuleenv_modulemodules/mod_env.so

LoadModuleexpires_modulemodules/mod_expires.so

LoadModuleheaders_modulemodules/mod_headers.so

LoadModuleident_modulemodules/mod_ident.so

LoadModulesetenvif_modulemodules/mod_setenvif.so

LoadModuleversion_modulemodules/mod_version.so

LoadModuleproxy_modulemodules/mod_proxy.so

LoadModuleproxy_connect_modulemodules/mod_proxy_connect.so

LoadModuleproxy_ftp_modulemodules/mod_proxy_ftp.so

LoadModuleproxy_http_modulemodules/mod_proxy_http.so

LoadModuleproxy_scgi_modulemodules/mod_proxy_scgi.so

LoadModuleproxy_ajp_modulemodules/mod_proxy_ajp.so

LoadModuleproxy_balancer_modulemodules/mod_proxy_balancer.so

LoadModulemime_modulemodules/mod_mime.so

LoadModuledav_modulemodules/mod_dav.so

LoadModulestatus_modulemodules/mod_status.so

LoadModuleautoindex_modulemodules/mod_autoindex.so

LoadModuleasis_modulemodules/mod_asis.so

LoadModuleinfo_modulemodules/mod_info.so

LoadModulecgi_modulemodules/mod_cgi.so

LoadModuledav_fs_modulemodules/mod_dav_fs.so

LoadModulevhost_alias_modulemodules/mod_vhost_alias.so

LoadModulenegotiation_modulemodules/mod_negotiation.so

LoadModuledir_modulemodules/mod_dir.so

LoadModuleimagemap_modulemodules/mod_imagemap.so

LoadModuleactions_modulemodules/mod_actions.so

LoadModulespeling_modulemodules/mod_speling.so

LoadModuleuserdir_modulemodules/mod_userdir.so

LoadModulealias_modulemodules/mod_alias.so

LoadModulerewrite_modulemodules/mod_rewrite.so

Timeout300--新增的配置参数

KeepAliveOn

MaxKeepAliveRequests1000

KeepAliveTimeout15

UseCanonicalNameOff

AccessFileName.htaccess

ServerTokensFull

ServerSignatureOn

HostnameLookupsOff

mpm_netware_module>

mpm_winnt_module>

#

#Ifyouwishhttpdtorunasadifferentuserorgroup,youmustrun

#httpdasrootinitiallyanditwillswitch.

#

#User/Group:

Thename(or#number)oftheuser/grouptorunhttpdas.

#Itisusuallygoodpracticetocreateadedicateduserandgroupfor

#runninghttpd,aswithmostsystemservices.

#

Userdaemon

Groupdaemon

----------------------------------以下内容是新增的关键参数

StartServers40

MinSpareServers40

MaxSpareServers80

MaxClients256

MaxRequestsPerChild10000

StartServers40

MaxClients2000

MinSpareThreads100

MaxSpareThreads300

ThreadsPerChild200

MaxRequestsPerChild0

ProxyRequestsOff

RewriteEngineon

RewriteCond%{REQUEST_METHOD}^(TRACE|TRACK)

RewriteRule.*-[F]

RewriteEngineon

RewriteCond%{HTTP:

range}!

(^bytes=[^,]+(,[^,]+){0,4}$|^$)

RewriteRule.*-[F]

TraceEnableoff

#NameVirtualHost10.46.85.137:

9080

#

9080>

#ServerName10.46.85.137:

9080

#ProxyPass/ponApp/http:

//10.209.122.40:

7001/xponApp/

#ProxyPassReverse/ponApp/http:

//10.209.122.40:

7001/xponApp/

#

 

NameVirtualHost10.46.85.137:

8088

8088>

ServerNamekuangdai--kuangdaiLINUX系统的主机名

ProxyPass/xponApp/http:

//10.209.122.40:

7001/xponApp/

ProxyPassReverse/xponApp/http:

//10.209.122.40:

7001/xponApp/

启动服务报错

--/etc/hosts增加127.0.0.1localhost.localdomainlocalhost”kuangdai“主机名

--配置反向代理的访问权限

Orderdeny,allow

Allowfromall

-----------------------------以上内容是新增的关键参数

#'Main'serverconfiguration

#

#Thedirectivesinthissectionsetupthevaluesusedbythe'main

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 人文社科 > 法律资料

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2