2

I am having a hosting server and i want to create a sub domain for apis hosted on same server.What i want is suppose I have my domain name domain.com and want to have sub domain api.domain.com and set a folder path /public_html/api for it to load APIs.What I did is created a sub domain in Domains/subdomains section in cpanel and set folder path there and then created a CNAME pointing to IP of my server. But unfortunately when I open it, it gives me error **Internal Server Error**.

Please suggest what need to do for configurations?

  • "created a CNAME pointing to IP of my server." - A CNAME points to another domain name, not an IP address. But, assuming your DNS and hosting are handled by the same provider then you shouldn't have to manually create the CNAME record - cPanel does this for you. – MrWhite Feb 8 '17 at 9:50
1

The message (Internal Server Error) means your hosting server issued a 5xx code to the client browser. This code indicates that the browser contacted the server but there was a problem serving content.

Although it's difficult to tell, it sounds like you've configured the DNS correctly but your server isn't configured to reply to the request.

You'll need to set Apache/Nginx/IIS up with a new virtual domain and point that to the resource folder. As you're doing an API, I imagine that will involve setting up a CGI (common gateway interface) with the program serving the API content.

Your next steps in setup would depend on your server / intended API program.

For a LAMP stack on Godaddy, follow these instructions:

  1. Install a LAMP stack.
  2. Setup a virtual host for api.example.com, and point it to your API directory.
  • i am writing apis in php and my domain and hosting is from godaddy. – Ali Akram Feb 8 '17 at 10:33
  • edited to explain that setup – L Martin Feb 8 '17 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.