Jump to content

How to make my website run on a non-standard port?


kevk3v

Recommended Posts

Sorry if this is the wrong section guys please move it to the correct place if this is not the correct place to ask.

I am trying to make a website run on a non-standard port.

Example by default mysite.com should have a port number of 80, so it runs on http://mysite.com:80 how do i make it run on any other port number such as 8080, 9055, 8090 or what ever non standard port i want?

I have seen this on many websites before so it is possible.

Please reply asap.

Can you tell me how to do this on a host like byethost32.com, 000webhost.com or if i cant do it like that, the correct way? thanks...

 

You'll need a dedicated server or a VPS. No shared host is going configure their web servers to listen on multiple ports for individual customers.

All you have to do is change the apache configuration file.

 

From this:

Listen 80

 

To this:

Listen xxxx

(replace xxxx with your port)

 

Next you need to restart apache, and then you can go to your site: http://mysite.com:xxxx

In the apache config there is going to be a

 

NameVirtualHost *:80

 

or similar statement.  The vhost section then references this:

 


servername foo.bar
...

 

Typically there's one or 2 NameVirtualHost statements and a whole slew of vhosts that will be using that same ip/port combination.

 

So if you wanted to have a Vhost on another port, you'd need a NameVirtualHost statement like:

 

NameVirtualHost *:8080

 

This could also be used to bind to a particular IP/Port

 

NameVirtualHost 10.1.1.10:8080

 

Regardless, you use the appropriate vhost directive, for example with the (all ips on machine, listen on port 8080:

 


servername host

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.