WebFaction
Community site: login faq

Is there a way to point an externally hosted subdomain to one of my applications? I know I can do this with a custom app and the listen port, but what if I just want a standard Apache/PHP setup?

Would I need a dedicated IP address for this, or would I have to build a custom app with Apache/PHP built from source to use it's own listen port? If so, how would building Apache/PHP from source affect my RAM usage vs the default PHP install script?

asked 06 Dec '11, 13:15

HittingSmoke
4822230
accept rate: 8%


Yes, you can do this.

First, the Custom Application (listening on port) and Apache (Static/CGI/PHP) applications do not work any differently in this respect. In order to explain more clearly why these two app types don't matter, it is necessary to explain a bit about how the system works.

  1. A domain is pointed to a machine via its DNS A record. This should point to the WebFaction webserver.
  2. A front-end Nginx server is listening on ports 80 (HTTP) and 443 (HTTPS) to receive incoming web requests. It sees the domain in the request, and passes this request onward.
  3. Where Nginx passes the request to depends on the Application type. If your application is a Custom Application (listening on port), then Nginx passes the request to 127.0.0.1:PORT, where PORT is the port assigned by the Custom application. If the application is a Static/CGI/PHP app, then Nginx passes the request on to Apache, which serves your page.
  4. Either your own private application server (in the case of a Custom App on port) or the server-wide Apache server (in the case of a Static/CGI/PHP app) returns a response to Nginx
  5. Nginx returns the response to the client who made the request in Step 2.

Therefore, in order to serve an externally-hosted subdomain from one of your applications, the only requirement is that this subdomain is pointed to your webserver via its DNS A record. Your webserver's IP address is listed in the Control Panel.

Once that is done, you need only to add the domain, application, and website record in the Control Panel, and Nginx will recognize the domain when web requests come in. Then it will be able to pass the request to your application, and the website association will work as expected.

Note that DNS changes can take some time to propagate. So if you receive some Site Not Configured errors immediately after making these changes; that's normal. Hope that helps!

permanent link

answered 06 Dec '11, 18:38

ryans ♦♦
5.0k93360
accept rate: 43%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×262
×225
×23
×19
×2

question asked: 06 Dec '11, 13:15

question was seen: 4,864 times

last updated: 06 Dec '11, 18:38

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM