1

I have managed to configure username as subdomain in nginx and php ( on localhost, I an not sure if it would work when I host it on DigitalOcean). But now I have two more queries/problems.

  1. Disable certain keywords like slangs, generic words etc in subdomains.
  2. reserve few keywords like test, beta, rc, which should be accessable only from our dev machines.

How do I achieve them?
Is it possible for nginx to access database, as I have a small table of those reserved words which I am using to disable registration on those words as username.

I am using PHP 5.6, Phalcon, nginx, Fedora (or ubuntu, We have mixed feeling on which to use on VPS).

Abhinav Kulshreshtha
  • 2,147
  • 1
  • 23
  • 38
  • If you want to disallow the use of "foo", do you disallow "bunnyfoo.yourdomain.com" or just "foo.yourdomain.com"? – Mike Sherrill 'Cat Recall' Feb 17 '15 at 09:37
  • I have a table of 830 banned words (vulgar, abusive, other kind of slangs) which we want to disallow completely, and another 15 words like beta, testing, test, etc which we only want to be able to access from our dev machines. I think "Foo.yourdomain.com" scenerio should be enough. – Abhinav Kulshreshtha Feb 17 '15 at 13:27
  • **Downvoters**, I dont mind downvoting questions, But I would prefer you tell me what is wrong so that I can adjust/correct the questions. Also, I have been on this for almost a week, So I did basic google search and stackoverflow search before asking here. – Abhinav Kulshreshtha Feb 17 '15 at 13:30
  • Worst case, you could just set up explicit routes that resolve to a "you can't use that word" web page. – Mike Sherrill 'Cat Recall' Feb 17 '15 at 15:20

2 Answers2

1

Use application code to disallow vulgar usernames. You have to check to see if a new user is trying to use an existing name. Check for vulgar names the same way.

Having disallowed vulgar usernames, you simply won't have vulgar subdomains if they're in the form username.domain.com.

Use "allow" and "deny" directives to restrict access by IP address.

Mike Sherrill 'Cat Recall'
  • 91,602
  • 17
  • 122
  • 185
  • Thanks for the link, It was really helpful. I am already handling usernames in program, I was hoping there was some way to restrict connections at server level. I guess even if there was, going through such long list of words would only degrade network performance. I would try to modify php code to improve performance of word detection. – Abhinav Kulshreshtha Feb 18 '15 at 06:50
-1

In subdomain there is some reserve keyword like ns1.example.com, ns[number].example.com and etc. you can't use this as your subdomain. Also it's not a good practice.