PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, September 21, 2022

[FIXED] How to map a domain to server?

 September 21, 2022     angularjs, digital-ocean, nginx, virtualhost     No comments   

Issue

My AngularJS application running on NGINX server user profiles. I want users to point their domains to their profiles.

Example http://example1.com would serve http://example.com/#/foo profile.

I have created a custom nameserver i.e. ns1.example.com but I am not sure how to configure NGINX to point to the correct user account.


Solution

This is the sort of thing that you'll want to handle at the application level, and not in Nginx. That is, rather than updating and reloading your Nginx config files you should have something server side (like a lightweight Node.js application, for example) that would inspect the Host header. If the Host header value isn't your domain, then look up that domain in your database and serve up a 301 redirect..

Also note that there are some compatibility problems with using a redirect to an anchor fragment (like #/foo). Make sure you test well with the browsers that your users use most commonly.



Answered By - Brad
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing