Possible to preview website at specific port number?

Hi,

I have a default install of Apache 2 on one of my linodes and I'd like to preview my apps before setting a domain to them. I read the following post about previewing the app/site on a subdomain — but I would like to know if it's possible to view it using a specific port number and if so could someone point me in the right direction on how to go about setting this up?

Or if anyone can offer a better method for previewing dev work?

I was thinking something like exampleport.com:4605 would be useful.

Many thanks,

Gavin

3 Replies

I would recommend modifying your local PC's host file.

Good suggestion, I have it setup like that at the moment. If I wanted to let others view it though, could I assign a port number to it?

Ok, I figured out what I need to do.

Following both of these links…

http://httpd.apache.org/docs/2.2/bind.html

http://httpd.apache.org/docs/2.2/vhosts … .html#port">http://httpd.apache.org/docs/2.2/vhosts/examples.html#port

I realised that I had to add the port for Apache to listen out for and then specify it in the virtual host file for that domain.

For example:

Inside /etc/apache2/ports.config

...

NameVirtualHost 12.34.56.78:80
Listen 80
# Add port you want to use
Listen 8080

...

Inside /etc/apaches2/sites-available/exampledomain.com

# Spedify the port number
 <virtualhost 12.34.56.78:8080="">...</virtualhost> 

And don't forget to reload Apache.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct