1

I have wrote a client.py and a server.py, they talk to each other with socket(not websocket) TCP connection.This is a C/S application. Now i want to use nginx to deploy the server, but i dont know how to do. I have look through some material about nginx, which is only talk about how to deploy websocket.

Any advise would be appreciate.Thanks.

2 Answers 2

1

Nginx will only help you if you want to use HTTP(s) protocol to communicate between your client and server. Python people usually do it with WSGI. A popular pair these days is NGIX + Gunicorn.

Here is a doc reference on how to set up Gunicorn with NGINX http://gunicorn-docs.readthedocs.org/en/latest/deploy.html

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for your reply. If i want to use TCP socket communication, what should i do to deploy the project? what kind of server should i choose? (flask, twisted, uWSGI or something else)
From the ones you listed only Twisted supports raw TCP socket communication. If you are implementing your own application protocol why do you need a server? Unless you really know what you doing, or just need some educational experience I strongly advise agains implementing your own protocol and just go with HTTP(s) or something else standard. (MQ)
This is my server.py github.com/justalittlenoob/Project-1/wiki/Server.py I am not sure whether it could accept 2000 people's TCP connection at the same time.(That's why i try to find a "server") If not, what should i do? I have no experience in this field. Would you like to give me some more advise? Thank you very much.
Do you mean 2000 connections open at the same time. This will push default linux kernel to the limits, but should work. However running 2000 threads with Python might cause more performance problems for you. For that type of load maybe NGIX + Unicorn might be a better solution for you. If HTTP is completely unacceptable for you look at Twisted
Thanks for your patience. I know what i should do next. I hope i can help others like you in the future.(btw, i am so sorry for not giving you upvote, because my reputation is less than 15 :(
0

Here is how it is done for SimpleHTTPServer. You have not shared your code, so can't say much.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.