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服务

Apache虚拟主机/端口多开的更多相关文章

  1. apache 虚拟主机详细配置:http.conf配置详解

    apache 虚拟主机详细配置:http.conf配置详解 Apache的配置文件http.conf参数含义详解 Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd. ...

  2. Apache虚拟主机配置

    在一个Apache服务器上可以配置多个虚拟主机,实现一个服务器提供多站点服务,其实就是访问同一个服务器上的不同目录.Apache虚拟主机配置有3中方法:基于IP配置.基于域名配置和基于端口配置,这里介 ...

  3. 烂泥:apache虚拟主机的学习与应用

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 要配置apache的虚拟主机,我们需要分以下几步进行: 1. 检查apache虚拟主机模块 2. 开启apache虚拟主机功能 3. httpd-vho ...

  4. Apache虚拟主机配置(多个域名访问多个目录)

    Apache虚拟主机配置(多个域名访问多个目录) 为了方便管理虚拟主机,我决定使用一种方法,那就是修改httpd-vhosts.conf文件. 第一步首先要使扩展文件httpd-vhosts.conf ...

  5. 配置apache虚拟主机的实例总结

    如何实现apache虚拟主机配置. 1.基于ip地址的虚拟主机Listen 80<VirtualHost 172.20.30.40> DocumentRoot /home/httpd/ht ...

  6. Ubuntu16.04+Apache虚拟主机配置详解

    在window下,Apache的配置文件是httpd.conf,但在Linux下安装了Apache后发现其配置并不像window下那么简单,Linux下Apache将各个设置项分在了不同的配置文件中, ...

  7. windows环境下,apache虚拟主机配置

    在windows环境下,apache从配置文件的相关配置: Windows 是市场占有率最高的 PC 操作系统, 也是很多人的开发环境. 其 VirtualHost 配置方法与 Linux 上有些差异 ...

  8. Linux Apache虚拟主机配置方法

    apache 虚拟主机配置 注意: 虚拟主机可以开很多个 虚拟主机配置之后,原来的默认/etc/httpd/httpd.conf中的默认网站就不会生效了 练习: 主机server0 ip:172.25 ...

  9. 配置Apache虚拟主机

    实验环境 一台最小化安装的CentOS 7.3虚拟机 配置基础环境 1. 安装apache yum install -y httpd 2. 建立虚拟主机的根目录 mkdir /var/wwwroot ...

随机推荐

  1. ZooKeeper系列(2) 安装部署 (转)

    原文地址:http://www.cnblogs.com/wuxl360/p/5817489.html 一.Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模 ...

  2. Python print函数参数详解

    官方文档 print(…)    print(value, …, sep=’ ‘, end=’\n’, file=sys.stdout, flush=False)    Prints the valu ...

  3. 深入分析Java Web技术内幕 修订版 pdf

    百度网盘:http://pan.baidu.com/s/1slHCCw9

  4. json , 正则

    json: import json user = { 'dsada': 'whichT','a':True,'b':None } a=json.dumps(user,indent=3,sort_key ...

  5. win10下装的ubuntu14.04双系统,ubuntu系统访问win10磁盘问题

    参考:https://blog.csdn.net/u010426270/article/details/52420231 ubuntu下 解决方法: 1. 在终端输入如下命令,查看分区挂载情况 sud ...

  6. node 图片上传功能

    node 代码: var http = require("http"); var express = require('express') app = express(), for ...

  7. Find 和 Findstr

    FIND 在文件中搜索文字字符串. FINDSTR 在文件中搜索字符串.   findstr能用正则表达式,而find不能   dir c:|find /N /I /C "windows&q ...

  8. sql server字符串的类型

    sql server字符串分为不同的类型,下面就将为您介绍几个sql server字符串的常见类型,希望对您学习sql server字符串能有所帮助. nchar 此数据类型可存储1~4000个定长U ...

  9. delphi 中判断对象是否具备某一属性

    Uses   TypInfo;         {$R   *.dfm}         procedure   TForm1.Button1Click(Sender:   TObject);     ...

  10. Ansiable Manage MySQL global variables

    mysql_variables - Manage MySQL global variables New in version 1.3. Synopsis Requirements (on host t ...