2

Say, If I am hosting a website say www.mydomain.com on EC2 instance then apache would be running on port 80. Now If I want to host a RESTful API (say mydomain.com/MyAPI) using a python script(web.py module). How can I do that? Wouldn't running a python script cause a port conflict?

2
  • You can run RESTful API on another port. If you want to run on same domain then you have to divert request for MyAPI. Commented Sep 20, 2014 at 13:44
  • why not create a api.maindomain.com with virtualhost in apache that proxies your request to python server. Commented Sep 20, 2014 at 17:18

1 Answer 1

3

No.

Apache is your doorman. Your python script are the workers inside the building. The public comes to the door and talks to the doorman. The doorman hands everything to the workers inside the building, and when the work is done, hands it back to the appropriate person.

Apache manages the coming and going of individual TCP/IP messages, and delegates the work that each request needs to do to your script. If the request asks for the API it hands it to the api script; if the request asks for the website it hands it to the website script. Your script passes back the response to apache, which handles the job of giving it to the client over port 80.

As @Lafada comments: you can have a backdoor—another port—but apache is still the doorman.

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

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.