zoukankan      html  css  js  c++  java
  • 【运维技术】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:WindowsSystem32driversetchosts

    127.0.0.1 test.dede.com
    # 使用ping命令进行域名解析
    C:Userswulon>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>
    
  • 相关阅读:
    Invalid bound statement (not found)解决方法
    MySQL的sum()函数
    关于Mybatis的java.lang.UnsupportedOperationException异常处理
    博客迁移
    Building Blog(个性化博客)2
    走一波服务器
    JZ高中OJ 1036. [SCOI2009]迷路
    JZ初中OJ 2296. [noip普及组2]神殿
    JZ初中OJ 2295. [noip普及组2]栈
    JZ初中OJ 2298. [noip普及组2]异或
  • 原文地址:https://www.cnblogs.com/fly-piglet/p/7705102.html
Copyright © 2011-2022 走看看