【运维技术】windows安装apache服务器,实现域名对应端口的解析跳转

linux 安装参考搭建dede项目的功能
windows 安装虚拟机的指南参考:http://jingyan.baidu.com/article/29697b912f6539ab20de3cf8.html

  • 修改配置文件支持虚拟主机
# 切换到配置路径
  cd /etc/httpd/conf
# 编辑配置的httpd的文件
vi httpd.conf
# 添加监听Listen的功能
Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/en
ServerName www.en.com

# Other directives here

</VirtualHost>


<VirtualHost *:80>
DocumentRoot /var/www/cn
ServerName www.cn.com

# Other directives here

</VirtualHost>

遇到问题apache服务器启动不了监听,实在查不到结果
问题:(13)Permission denied: AH00072: make_sock: could not bind to address [::]:

  1. 说明是 selinux中的设定
# 增加selinux中http的端口
#查看SELinux下http相关端口
semanage port -l|grep http
#增加这个非标准端口即可
semanage port -a -t http_port_t -p tcp 8000
  • 本地模拟域名修正

修改hosts文件:C:\Windows\System32\drivers\etc\hosts

127.0.0.1 test.dede.com
# 使用ping命令进行域名解析
C:\Users\wulon>ping test.dede.com
Pinging test.dede.com [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

apache虚拟主机配置-域名/IP和端口两种配置参考教程:http://jingyan.baidu.com/article/4f7d5712d48a191a201927e0.html

外部访问的时候一定记得关闭防火墙

#Listen 12.34.56.78:80
Listen 80
Listen 8090

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
NameVirtualHost *:8090

<VirtualHost *:80>
DocumentRoot /var/www/en
ServerName www.aoscom.org

# Other directives here

</VirtualHost>

<VirtualHost *:80>
DocumentRoot /var/www/cn
ServerName www.aoscom.cn

# Other directives here

</VirtualHost>

<VirtualHost *:8090>
DocumentRoot /var/www/cn
ServerName www.aoscom.org:8090

# Other directives here

</VirtualHost>
posted @ 2017-10-21 16:24  努力编程的小猪  阅读(1654)  评论(0编辑  收藏  举报