Web Hosting Talk


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : How to have my server use a different port?
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)

 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-07-2008, 09:44 PM
TuxifieD TuxifieD is offline
View Beta Profile
Newbie
 
Join Date: Oct 2005
Posts: 9
How to have my server use a different port?

port 80 runs, but has no protection, I have the server protected on port 82, I want a way to beable to have a user when they go to my site automaticly be on port 82 but it not be shown at the end of the domain like it is now. anyway to do this?

Reply With Quote
Sponsored Links
  #2  
Old 10-07-2008, 10:31 PM
pauln pauln is offline
View Beta Profile
Newbie
 
Join Date: Jun 2008
Location: San Diego CA
Posts: 22
You can edit your web server config to run on port 82. The user will have to specify ":82" at the end of the domain since it's a non-standard HTTP port.

Reply With Quote
  #3  
Old 10-07-2008, 11:11 PM
RoseHosting RoseHosting is offline
View Beta Profile
Junior Guru
 
Join Date: Nov 2001
Posts: 208
If your server is running on some linux distribition, you can do that by using iptables' PREROUTING rule. Install iptables if this application is not insalled on your server by default and run the 'mcedit /etc/sysconfig/iptables' or 'vi /etc/sysconfig/iptables' commands and insert the following lines at the beginig of the file:
============================================================================
*nat

-A PREROUTING -d xxx.xxx.xxx.xxx -p tcp --dport 80 -j REDIRECT --to-port 82

COMMIT
============================================================================
Change the 'xxx.xxx.xxx.xxx' with your server's IP address, save changes to the file and restart iptables. That's it.

__________________
---=== RoseHosting.com Admin ===---
Linux Web Hosting - rosehosting.com
Linux VPS Hosting Specials - rosehosting.com/virtserv-spec.html
High Quality Linux virtual servers with lots of Guaranteed RAM and HDD space, Impeccable Service.

Reply With Quote
Sponsored Links
  #4  
Old 10-08-2008, 12:14 AM
RoseHosting RoseHosting is offline
View Beta Profile
Junior Guru
 
Join Date: Nov 2001
Posts: 208
If the above rule does not work, you could also try to add the following lines to the '/etc/sysconfig/iptables' file:
===================================================================================
*nat

-A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination xxx.xxx.xxx.xxx:82
-A POSTROUTING -s xxx.xxx.xxx.xxx -p tcp --sport 80 -j MASQUERADE

COMMIT
===================================================================================
Change the 'xxx.xxx.xxx.xxx' with your server's IP address, save changes to the file and restart iptables.

I hope this helps.

__________________
---=== RoseHosting.com Admin ===---
Linux Web Hosting - rosehosting.com
Linux VPS Hosting Specials - rosehosting.com/virtserv-spec.html
High Quality Linux virtual servers with lots of Guaranteed RAM and HDD space, Impeccable Service.

Reply With Quote
  #5  
Old 10-08-2008, 01:08 AM
TuxifieD TuxifieD is offline
View Beta Profile
Newbie
 
Join Date: Oct 2005
Posts: 9
thanks alot

im going to try this out and if it works ill let you know! thanks alot

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement: