I want to create a website which will serve more like a web-application. There will be two parts: the front-end (probably in PHP, Apache) and the back-end services (in Python, using Twisted) The front-end will usually provide some JavaScript which would send Ajax requests to the Python services and receive data back.
Since Apache will be listening on port 80, the Python services should listen to another port.
So my question is the following: what port should the Python services listen to? I am asking because I am afraid it might get blocked by the proxies, firewalls etc. that not so rarely get in front of the client's way.What would be the most sta开发者_高级运维ndard, problem-free way to do this?
The normal choice is http-alt
(8080).
You can be blocked all and everywhere. Any uncommon port is likely to be blocked by serious firewall configurations. Either get a dedicated IP address and listen to port 80. Best to talk to your IT network guys.
If you're intending for this to be distributed, you'd have to use a port above 1024, otherwise people using it on a Unix-type system would have to run it as root, which opens very large can of worms as far as security is concernted.
If you mean problem-free for yourself, a separate port like 8080 would be appropriate.
If you mean problem-free for your users, ports 80 (http) and 443 (https) are the only choices that make sense because they're the least likely to be blocked by firewalls. Of course, that means your application and web service would be sharing a port, so you'd have to run your python code behind Apache or whatever else is serving your PHP code and static files. Are you married to Twisted? Why not build your Python web service using one of the many WSGI-compatible web frameworks, and plug it into Apache using mod_wsgi?
精彩评论