Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For each development sites I want to have a unique port number. For instance,

This is what I have in my httpd.conf file. After restart the page is not showing in the browser. Is there anything else that I need to do besides what I have already done to make this work?

Listen *:1234

<VirtualHost *:1234>
DocumentRoot /var/www/dev_sites/test

It looks like if I go to my local hostname (kk.local:1234) it shows. Is there some sort of dns that I need to do? I really don't want to go into godaddy everytime I add a development site. Is there a way around that?

share|improve this question

closed as off topic by Michael Hampton, Tom O'Connor, mdpc, rnxrx, EEAA Oct 31 '12 at 0:53

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

What does it says netstat -tulnp ? Do you see anything listening on port 1234 ? – golja Oct 27 '12 at 13:18
Looks like it is...tcp 0 0 :::1234 :::* LISTEN - – user983223 Oct 27 '12 at 13:20
Does resolve to the correct address on the client? Does the browser show an error message? Does the website access show in your Apache log files? – Ansgar Wiechers Oct 28 '12 at 0:42
@AnsgarWiechers - resolves correctly along with just entering the ip of the machine. Also my local hostname:port works. and ip:port does not. It is like it doesn't allow external access or something. Which makes me think firewall but SELinux and Firewall are disabled. – user983223 Oct 28 '12 at 13:48
Try telnet 1234. If you get connection refused or a timeout, something is blocking access to that port. Use tcptraceroute (on Windows tracetcp to find out where. If telnet can establish a connection, you should see something in your Apache logs. – Ansgar Wiechers Oct 28 '12 at 23:48

Adding the name/address mapping to your client's hosts file should get you around the name resolution problem in development scenarios. There's also the option to set a wildcard record in DNS if your DNS provider allows it. As soon as the thing goes beyond developer scope I'd strongly recommend setting up proper DNS resolution for it, though.

share|improve this answer
I want it to be accessible to the public so I'm trying to avoid the hosts file. – user983223 Oct 27 '12 at 22:53

The ServerName should not include the port number. In your example, just make it "" for every VirtualHost. ServerName directives do not need to be unique in your situation where you have each VirtualHost on a different port. You also don't need the NameVirtualHost because you're doing virtual hosting by port (although it's not harmful to include).

As a troubleshooting step, make sure IPTables is fully disabled (assuming this is Linux), and verify that by doing "iptables -L -n -v"; look for each table to be empty. You might also make sure SELinux is disabled; see your distro's documentation for how to do that properly, as the procedure varies. If either of those is shown to be the issue, you can either choose to keep them turned off, or configure them correctly to allow Apache to listen on these ports.

Here is an example from the Apache 2.2 documentation about port-based virtual hosting:

share|improve this answer
I fixed the ServerName. I added the NameVirtualHost (even though you said it wasn't required). Iptables each table is empty. Firewall and SELinux are disabled. I'm stumped. – user983223 Oct 27 '12 at 22:55

Is there a firewall like iptables that is blocking it? If so, turn it off or better yet add a rule to allow 1234 through.

share|improve this answer
@Michael_Beattie - firewall has been off. Is there a command line to test it? Would it still Listen in the netstat if it was being blocked by the firewall? – user983223 Oct 27 '12 at 14:05

Do you have this directive in your configuration:

NameVirtualHost *:1234

If you don't your VirtualHost will never be used.

share|improve this answer
added this but no improvement. – user983223 Oct 27 '12 at 22:52

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