windows下安装Apache并注册为服务

一、下载
1. 进入官网http://httpd.apache.org/download.cgi,找到需要的版本
在这里插入图片描述

2. 选择下载渠道
在这里插入图片描述

3. 选择需要的类型
在这里插入图片描述

二、安装
0.根据ReadMe.txt中说明安装VC++,否则会提示找不到vcruntime.dll之类的错误
在这里插入图片描述

1. 将下载的文件解压到相应的目录后,定义服务目录路径SRVROOT为D:\software\httpd-2.4.20-x64-vc14-r2\Apache24
全局替换默认路径为${SRVROOT}
在这里插入图片描述

2. 用管理员身份运行cmd,进入apache httpd目录,并安装服务

-k install    //默认安装,一般使用默认即可
-k install -n “服务名”    //安装且重命名
-k install -n “服务名” -f “\my server\conf\my.conf”    //指定配置文件安装且重命名

在这里插入图片描述

3. 运行ApacheMonitor.exe,增加服务
在这里插入图片描述

4. 测试
在这里插入图片描述

5. 发布应用
在这里插入图片描述
在这里插入图片描述

6. 配置反向代理,监听域名和端口

<IfModule mpm_winnt_module>
    ThreadsPerChild 1024
    MaxRequestsPerChild 10000
</IfModule>

AcceptFilter http none 
AcceptFilter https none 
EnableSendfile Off  
EnableMMAP off

<VirtualHost *:80>
   ServerName www.xxx.com
   ProxyRequests Off
   ProxyPreserveHost On
   ProxyPass / http://127.0.0.1:18080/
   ProxyPassReverse / http://127.0.0.1:18080/
   ErrorLog "logs/www.xxx.com_error.log"
   CustomLog "logs/www.xxx.com_access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerName b.xxx.com
    DocumentRoot "D:/wwwroot/test
    ErrorLog "logs/b.xxx.com_error.log"
    CustomLog "logs/b.xxx.com_access.log" common
</VirtualHost>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值