change the standard Apache port

dantess

New member
Joined
Feb 6, 2008
Messages
2
Dear Sirs!
I need to change the standard Apache port from 80 to 808(we want to set nginx as a frontend).

I`ve strictly followed this instruction:
http://help.directadmin.com/item.php?id=2

cd /usr/local/directadmin/data/templates
cp virtual_host*.conf custom
cd custom

Than i`ve changed port 80 to 808 in all the files in /usr/local/directadmin/data/templates/custom

<VirtualHost |IP|:80>
to
<VirtualHost |IP|:808>

In /etc/httpd/conf/httpd.conf

I`ve changed
Listen 80
Listen 443

to
Listen 808
Listen 443

then
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue

Everething goes ok, but there is an auto insert to user's httpd.conf (line after comments - Port 80)
# Auto generated apache config file by DirectAdmin version 1.31.2
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to his/her website

# Frontpage requires these parameters in every httpd.conf file or else
# it won't work.
Port 80
ServerRoot /etc/httpd

How can i change it?


Beside that i found a topic in russian version of Google Answers:
http://otvety.google.ru/otvety/thread?tid=26436fe31991b29a&table=/otvety/&pli=1

It says:
"We proceed from the premise that the DirectAdmin listens itself the external ip on port 80,
and we can change that - there are different views on this, but it is in most correct. Therefore, we will not touch the directadmin.
Decision:

iptables-t nat-A PREROUTING-d 83.222.25.17-i eth0-p tcp-m tcp - dport 80-m state - state NEW-j REDIRECT - to 85-ports

As a result, all requests that are coming from outside to ip 83.222.25.17 port 80 - will go to 85 port.

Nginx must listen 83.222.25.17:85 and proxy_pass http://83.222.25.17;

Then nginx will receive at 85 port a request and proxies it to apache to 80 port".

This solution, of course, works. But is there another way?


P.s.
I`ve searched this forum for several times.
The most similar topic was
http://www.directadmin.com/forum/showthread.php?t=19817
but the recommendations, that are given are not working in my case - the line "port 80" does not change.
 
My servers dont even have the port 80 in users httpd.conf. What version apache are you using?

How bout trying:

cd /usr/local/directadmin/custombuild
./build rewrite_confs
 
Hello,

The top section of the User httpd.conf files is hardcoded.
However, if you were to install apache 2.0 or 2.2, the "Port 80" bit will dissapear, so you'll be able to move forward without it.
http://files.directadmin.com/services/custombuild/1.1

Related templates:
ips_virtual_host.conf
redirect_virtual_host.conf
virtual_host.conf
virtual_host2.conf
virtual_host2_sub.conf
virtual_host_sub.conf

not that the virtual_host2_* files apply to apache 2.0/2.2, while the virtual_host_* files apply to apache 1.3.

Other useful commands:
Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
echo "action=rewrite&value=ips" >> /usr/local/directadmin/data/task.queue
The "ips" version will rewrite the /etc/httpd/conf/ips.conf file.

John
 
My servers dont even have the port 80 in users httpd.conf. What version apache are you using?

Apache 1.3.39
DirectAdmin 1.31.2

Hello,
The top section of the User httpd.conf files is hardcoded.
However, if you were to install apache 2.0 or 2.2, the "Port 80" bit will dissapear, so you'll be able to move forward without it.

Unfortunately, Apache 2.x does not fit categorically for us...
So, the only way to put nginx as frontend is:
iptables-t nat-A PREROUTING-d 83.222.25.17-i eth0-p tcp-m tcp - dport 80-m state - state NEW-j REDIRECT - to 85-ports
isn`t it?
 
using that

Code:
iptables-t nat-A PREROUTING-d 83.222.25.17-i eth0-p tcp-m tcp - dport 80-m state - state NEW-j REDIRECT - to 85-ports

how to revert it back to default listening port?,
 
Remove the rule from iptables or restart iptables (before restart update your iptables config or your script with iptables rules).
 
Remove the rule from iptables or restart iptables (before restart update your iptables config or your script with iptables rules).


tnx, im concern of might removing all the rules and messing up, i just want to delete that rule above how can I do that via ssh, using centos btw
 
Back
Top