我可以在同一台计算机上运行两个 Web 服务器吗? [英] Can I run two web servers on the same computer?

查看:35
本文介绍了我可以在同一台计算机上运行两个 Web 服务器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚发现我可以使用 Python 编写一个真正简单的网络服务器.我已经有一个 Apache Web 服务器,我想在这台机器上尝试基于 Python 的 Web 服务器.但是我担心如果我尝试一下,我会遇到某种冲突.我的意思是两个 Web 服务器将如何决定"谁需要处理来自客户端的请求?

I just found out that I can write a really simple web server using Python. I have already an Apache web server I would like to try the Python based web server on this machine. But I am afraid that I can get some kind of conflict if I try it. I mean how two web server will "decide" who needs to server a request from a client?

推荐答案

让他们监听不同的端口,你会没事的.

Make them listen to different ports and you will be fine.

默认的web端口是80.当你在浏览器中打开一些url没有指定端口时,默认使用80.

The default web port is 80. When you open some url in browser without specifying a port, 80 is used by default.

您可以将 Web 服务器配置为侦听不同的端口,但您还需要在 url 中明确指定它:

You can configure your web server to listen to a different port but then you will also need to specify it explicitly in the url:

http://localhost:8080

在选择端口时,请注意此特定端口号尚未被您在机器上安装和运行的任何软件使用.否则,正如你猜对的那样,就会发生冲突.

When choosing a port pay attention that this particular port number is not yet in use by any software you have installed and running on your box. Otherwise, as you correctly guessed, there will be a conflict.

附言就在几天前重新安装时,我发现 IIS 无法启动(似乎没有原因).原来新版Skype占用了这个默认端口!必须删除其设置使用端口 80 和 443 作为传入连接的替代选项".

P.S. Just a few days ago doing reinstallation I got IIS not able to start (seemingly without reason). Turned out the new version of Skype occupied this default port! Had to remove its setting "Use port 80 and 443 as alternatives for incoming connections".

这篇关于我可以在同一台计算机上运行两个 Web 服务器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆