php Apache 和 IIS 7 一起运行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5957947/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Apache and IIS 7 running together
提问by Gainster
I am working on windows 7. IIS 7 and XAMPP are installed on the same computer. I have been playing with win host file and apache configuration files into to understand Server Root and directory.
我在 Windows 7 上工作。IIS 7 和 XAMPP 安装在同一台计算机上。我一直在玩win主机文件和apache配置文件来了解服务器根目录。
I dont know where i messed up, that know when i type localhost it shows me IIS 7 screen and when localhost/xampp then apache screen.
我不知道我在哪里搞砸了,我知道当我输入 localhost 时它会显示 IIS 7 屏幕,当 localhost/xampp 然后是 apache 屏幕时。
How can IIS and apache run together at port 80 ? confused.
IIS 和 apache 如何在端口 80 上一起运行?使困惑。
回答by Wyatt Barnett
It is doable. The thing to keep in mind is that no 2 services can share the same port and IP address. Unfortunately, IIS takes over port 80 completely on the magic 0.0.0.0 address. What you need to do is re-bind apache and IIS to different IP addresses as well as remove the 0.0.0.0 binding. Not exactly sure how to get there on IIS7 (presuming you are running it given IE9 in the screenies), last time I pulled this stunt IIS6 was hawt.
这是可行的。要记住的是,没有 2 个服务可以共享相同的端口和 IP 地址。不幸的是,IIS 在神奇的 0.0.0.0 地址上完全接管了端口 80。您需要做的是将 apache 和 IIS 重新绑定到不同的 IP 地址以及删除 0.0.0.0 绑定。不完全确定如何在 IIS7 上到达那里(假设您在屏幕中的 IE9 下运行它),上次我拉这个特技 IIS6 是轴。
A more sane option would be to setup a reverse proxy on 80 and have it hand stuff out to different web servers based on whatever rational criteria you want to use.
更明智的选择是在 80 上设置一个反向代理,并根据您想要使用的任何合理标准将内容分发到不同的 Web 服务器。
EDIT: found the magic juju, IIS7 post #44 - IIS7 and Apache on the same machine.
编辑:在同一台机器上找到了神奇的 juju,IIS7 post #44 - IIS7 和 Apache。
回答by Jeff Brewster
How To Run IIS And XAMPP Together On Same Machine
如何在同一台机器上同时运行 IIS 和 XAMPP
It is possible to run both IIS and XAMPP servers together on same machine by just changing the port number of any one of the server's. XAMPP-Apache and IIS both the server's uses the same port 80 to connect. In this post i am going to show you how to change the port number for the XAMPP-Apache server. Changing the port number for Apache server allows you to run both IIS and XAMPP server's on same machine using different port's.
只需更改任何一个服务器的端口号,就可以在同一台机器上同时运行 IIS 和 XAMPP 服务器。XAMPP-Apache 和 IIS 服务器都使用相同的端口 80 进行连接。在这篇文章中,我将向您展示如何更改 XAMPP-Apache 服务器的端口号。更改 Apache 服务器的端口号允许您使用不同端口在同一台机器上运行 IIS 和 XAMPP 服务器。
Firstly, You need to know the folder where XAMPP is installed (root folder). The default folder is c:\xampp. From the root folder navigate to " apache\conf " folder and find the file "httpd.conf".
首先,您需要知道安装 XAMPP 的文件夹(根文件夹)。默认文件夹是 c:\xampp。从根文件夹导航到“apache\conf”文件夹并找到文件“httpd.conf”。
Before editing the file, make a backup of it with a name "httpd.conf.bak" so that if something goes wrong you can replace this file. Now open the file "httpd.conf" with an editor like notepad. You need to make two edits to the file.
在编辑该文件之前,使用名称“httpd.conf.bak”对其进行备份,以便在出现问题时可以替换该文件。现在使用记事本等编辑器打开文件“httpd.conf”。您需要对文件进行两次编辑。
The first one:
第一个:
Find out the below lines in the file.
找出文件中的以下几行。
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 80
change it as shown below:
改变它,如下图所示:
#Listen 0.0.0.0:80
#Listen [::]:80
Listen 8080
The second edit:
第二次编辑:
Find the below line:
找到以下行:
ServerName localhost:80
change it to:
将其更改为:
ServerName localhost:8080
You have finished changing the port number. Now restart your apache server from the xampp control panel and its ready to run.
您已完成更改端口号。现在从 xampp 控制面板重新启动您的 apache 服务器并准备运行。
Open your browser and and enter the address localhost:8080
. You can see the root folder of apache opened. There is no need to make any changes to the IIS server and you an access it by just entering the address localhost
in your browser.
打开浏览器并输入地址localhost:8080
。可以看到apache的根文件夹打开了。无需对 IIS 服务器进行任何更改,只需localhost
在浏览器中输入地址即可访问它。
In the above screenshot you can see the IIS server being accessed through localhost
and XAMPP server through localhost:8080
on the same machine and even the same browser at a time.
在上面的截图中,您可以看到在同一台机器甚至同一浏览器上访问 IIS 服务器localhost
和 XAMPP 服务器localhost:8080
。
回答by mircaea
In case of trying to get XAMPP (Apache) and IIS (5.1) working on WinXP this is what I did:
如果试图让 XAMPP (Apache) 和 IIS (5.1) 在 WinXP 上工作,这就是我所做的:
C:\xampp\apache\conf\httpd.conf: Search for “Listen 80″, change to “Listen 8080″ Search for “ServerName localhost:80″, change to “ServerName localhost:8080″
C:\xampp\apache\conf\httpd.conf:搜索“Listen 80”,改为“Listen 8080”搜索“ServerName localhost:80”,改为“ServerName localhost:8080”
C:\xampp\apache\conf\extra\httpd-ssl.conf Search for “Listen 443″, change to “Listen 4499″ Search for “”, change to “” Search for “ServerName localhost:443″, change to “ServerName localhost:4499″
C:\xampp\apache\conf\extra\httpd-ssl.conf 搜索“Listen 443”,更改为“Listen 4499” 搜索“”,更改为“” 搜索“ServerName localhost:443”,更改为“服务器名称本地主机:4499″
[Then, access your Apache side by running localhost:8080 and ISS side by simple loccalhost]
[然后,通过简单的 loccalhost 运行 localhost:8080 和 ISS 来访问你的 Apache 端]
回答by gdmanandamohon
I have faced the same problem. However I have solved this way. I got it from here, it was really effective for me when all solutions were unable to provide me absolute solution.
我遇到了同样的问题。不过我是这样解决的。我从这里得到它,当所有解决方案都无法为我提供绝对解决方案时,它对我来说真的很有效。
- Go to Control Panel > Administrative Tools > Click Services
- Find “World Wide Web Publishing Service”
- Right click and select “Stop”
- Right click and select “Properties”, then change “Startup type” to “Manual”
- 转到控制面板 > 管理工具 > 单击服务
- 找到“万维网发布服务”
- 右键单击并选择“停止”
- 右键单击并选择“属性”,然后将“启动类型”更改为“手动”
If this doesn't fix it, you can find out what is using port 80 as follows:
如果这不能解决它,您可以按如下方式找出正在使用端口 80 的内容:
In a Command Prompt, run ‘netstat -ao > netstat.txt' to write active connections and associated process IDs (PID) to a file (for me, there were too many to just view them in the command prompt) Find the PID that is listening on port 80 (0.0.0.0:80) – for me, the PID was 4, which seems quite common Open Task Manager (Ctrl + Shift + Esc), right click on the column headers, and then click PID to show the PID column. Sort by PID to find the process for the PID that you identified above. Once you know the process that is causing the problem, a bit of Googling (other search providers are available) should help you fix it.
在命令提示符中,运行 'netstat -ao > netstat.txt' 将活动连接和相关进程 ID (PID) 写入文件(对我来说,在命令提示符中查看它们的数量太多)找到那个 PID正在侦听端口 80 (0.0.0.0:80) – 对我来说,PID 是 4,这似乎很常见 打开任务管理器 (Ctrl + Shift + Esc),右键单击列标题,然后单击 PID 以显示PID 列。按 PID 排序以查找您在上面标识的 PID 的进程。一旦您知道导致问题的过程,一些谷歌搜索(其他搜索提供程序可用)应该可以帮助您解决问题。
回答by Srujan Reddy
It is possible to run both IIS and XAMPP on same machine by just changing the port number which is used by XAMPP server. Read this article to know how to change port number:
只需更改 XAMPP 服务器使用的端口号,就可以在同一台机器上运行 IIS 和 XAMPP。阅读本文以了解如何更改端口号:
http://www.gooshareit.com/2012/03/how-to-run-iis-and-xampp-together-on.html
http://www.gooshareit.com/2012/03/how-to-run-iis-and-xampp-together-on.html