• Apache虚拟主机/端口多开


    Apache就是强大啊,简单配置一下就可以再开启另一个端口的web服务。

    笔者最近使用XAMPP架设php服务端。有一些特别的需求:同样的代码,需要开始不同的端口,

    协议类型提供web服务给客户端(http/https)。

    http服务端口多开

    配置方法:

    打开httpd.conf在

    Listen 80

    下面添加

    Listen 8080

    然后打开conf/extra/httpd-vhosts.conf

    添加

    <VirtualHost *:8080>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "D:/develop/xampp/htdocs/dummy-host2.example.com"
    ServerName dummy-host2.example.com
    ErrorLog "logs/dummy-host2.example.com-error_8080.log"
    CustomLog "logs/dummy-host2.example.com-access_8080.log" common
    </VirtualHost>

    https服务端口多开

    配置方法:

    打开

    httpds-vhosts.conf添加

    <VirtualHost *:8081>
    
    DocumentRoot "D:/develop/xampp/htdocs"
    ServerName www.example.com:8081
    ServerAdmin admin@example.com
    ErrorLog "D:/develop/xampp/apache/logs/error_8081.log"
    TransferLog "D:/develop/xampp/apache/logs/access_8081.log"
    
    SSLEngine on
    
    
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
    
    
    <FilesMatch ".(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory "D:/develop/xampp/apache/cgi-bin">
    SSLOptions +StdEnvVars
    </Directory>
    
    
    BrowserMatch "MSIE [2-5]" 
    nokeepalive ssl-unclean-shutdown 
    downgrade-1.0 force-response-1.0
    
    CustomLog "D:/develop/xampp/apache/logs/ssl_request_8081.log" 
    "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"
    
    </VirtualHost>

     以上配置彼此对立不互斥。修改以后重启apache服务,即可同时开始80/8080,443/8081服务

  • 相关阅读:
    实用 zsh 插件
    laravel 实用扩展包
    laravel Collection mapToDictionary 例子
    laravel mapSpread 例子
    mac 命令行大杂烩
    iview table中 on-view事件点击无效
    github网站打不开了
    iview table 表头样式修改
    $attrs is readonly
    iview中modal如何修改标题颜色
  • 原文地址:https://www.cnblogs.com/passedbylove/p/7189913.html
Copyright © 2020-2023  润新知