Help - Search - Members - Calendar
Full Version: Redirecting a port to a web page.
Neowin Forums > *nix Customization & Support > Linux Server/BSD/Unix
TrickierStinky
hi,

I recently set up my first server and I would like to know how I can redirect a localhost:8022 to my Ip/domain name address such as

192.168.1/ajaxterm or domain.com/term

I'm using the latest version of debian and on a ppc if thats any help?

also if not any hassle can i be told in a step by step way please im a linux newb so i need to simpleton stuff tongue.gif
xcguy87
Quote - (TrickierStinky @ Jun 15 2008, 15:27) *
hi,

I recently set up my first server and I would like to know how I can redirect a localhost:8022 to my Ip/domain name address such as

192.168.1/ajaxterm or domain.com/term

I'm using the latest version of debian and on a ppc if thats any help?

also if not any hassle can i be told in a step by step way please im a linux newb so i need to simpleton stuff tongue.gif


This is what I would do:

Install and configure Apache web server.
Open firewall port.
Create an index page to redirect users to the new website.

Okay, I don't normally use debian, so I am not extremely familiar with the structure, and I don't know if this is the "best" way to do this, but I would do it like this:

1) Login as root:

CODE
su -


2) Download the source code for Apache web server from:
http://download.filehat.com/apache/httpd/httpd-2.2.9.tar.gz

CODE
wget http://download.filehat.com/apache/httpd/httpd-2.2.9.tar.gz


3) Decompress and extract source:
CODE
gzip -d httpd-2.2.9.tar.gz

tar -xvf httpd-2.2.9.tar


4) Configure, make, make install (build the source for your environment)
CODE
cd httpd-2.2.9

./configure

make

make install


5) Apache web server is now installed, we need to configure the port.
CODE
cd /etc/httpd/conf/

vi httpd.conf


Here you must edit Apache's configuration file, and set it to listen on the correct port.
Change the line that reads: "Listen 80" to "Listen 8022" or whatever port you want.
You can make changes to the file by first pressing "i" to enter into VI's edit mode.
To save, hit ESC to return to command mode and type "wq".

6) Create a new index.html page.
CODE
vi /var/www/html/index.html


Edit the page to have this HTML:
CODE
<html>
<head>
<meta http-equiv="refresh" content="0;url=http://www.neowin.net/">
</head>
<body>
This page has moved to <a href="http://neowin.net/">http://neowin.net/</a>
</body>
</html>

Save the file the same way as before.

7) Alter your firewall rules.
This step is platform and install specific.
If your using gnome and iptables click on System -> Administration -> Firewall.
Open up port 8022.

8) Start/Restart Apache web server.
CODE
/etc/init.d/httpd restart


Thats it.
Hope it works for you.
Jay R.
Quote - (xcguy87 @ Jun 16 2008, 00:02) *
This is what I would do:

Install and configure Apache web server.
Open firewall port.
Create an index page to redirect users to the new website.

Okay, I don't normally use debian, so I am not extremely familiar with the structure, and I don't know if this is the "best" way to do this, but I would do it like this:

1) Install Apache2
CODE
sudo apt-get install apache2


2) Apache web server is now installed, we need to configure the port.
CODE
cd /etc/apache2

vi apache2.conf


Here you must edit Apache's configuration file, and set it to listen on the correct port.
Change the line that reads: "Listen 80" to "Listen 8022" or whatever port you want.
You can make changes to the file by first pressing "i" to enter into VI's edit mode.
To save, hit ESC to return to command mode and type "wq".

3) Create a new index.html page.
CODE
vi /var/www/index.html


Edit the page to have this HTML:
CODE
<html>
<head>
<meta http-equiv="refresh" content="0;url=http://www.neowin.net/">
</head>
<body>
This page has moved to <a href="http://neowin.net/">http://neowin.net/</a>
</body>
</html>

Save the file the same way as before.

4) Alter your firewall rules.
This step is platform and install specific.
If your using gnome and iptables click on System -> Administration -> Firewall.
Open up port 8022.

5) Start/Restart Apache web server.
CODE
/etc/init.d/apache2 restart


Thats it.
Hope it works for you.

Save yourself the trouble of compiling smile.gif
xcguy87
Quote - (Jay R. @ Jun 16 2008, 13:06) *
Save yourself the trouble of compiling smile.gif


I wasn't sure if aptitude was installed by default on Debian systems so I went with the compiler.
Thanks, that certainly makes it a lot easier.

Just a quick question about it though.
Without using sudo for each step he won't be able too:
1) Edit apache's configuration file: /etc/apache2/apache2.conf
2) Change anything in /var/www/
3) Restart the apache2 daemon
...right?

Why not just use 'su -'?
Jay R.
Good point. I overlooked that, normally use root myself. blush.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.