'Subdomain with port number in Ubuntu 12.04 (Precise Pangolin)
I have created subdomain in my DNS server. How can I set each subdomain so that it only accepts connections via a particular port?
For example: ftp.example.com → only accepts connections that come from port 21
Solution 1:[1]
You can set port restrictions using iptables.
You can also set port restrictions on the server itself and it depends on your server architecture. If you're running Apache, then you should take a look at defining a virtual host (vhost).
Just for illustration sake:
<VirtualHost *:21>
ServerAdmin [email protected]
ServerName ftp.example.com
# Index + Directory root
DirectoryIndex index.php | index.html
DocumentRoot /var/www/path/to/site
</VirtualHost>
See that "*:21" - that's the port number.
Generally speaking, ftp.example.com would probably still redirect to your server's root directory.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Peter Mortensen |
