【運維技術】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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM