Port was replaced with Listen in Apache 2.0

dwm

Verified User
Joined
Dec 4, 2007
Messages
64
Location
Netherlands
I have had more than once this message using apache 2.0 with custombuild:
/usr/local/directadmin/custombuild# /etc/init.d/httpd start
Starting httpd: Syntax error on line 7 of /usr/local/directadmin/data/users/customer/httpd.conf:
Port was replaced with Listen in Apache 2.0

Where can i find the 'Port 80' part, in which template? It is not in the virtualhost templates. But it is somethings in the virtualhosts output configs:

# Auto generated apache config file by DirectAdmin version 1.31.1
# 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
 
John told me more than twice that is SHOULD work. But it doesnt work..

I have tested with doing a rewrite_confs after every user action, but that slows down the whole navigation within DirectAdmin. So I made some cool scripts to manage the rewrite_confs on the background.

# cd /usr/local/directadmin/scripts/custom/
# pico domain_create_post.sh
#!/bin/sh

# Cronjob to trigger custombuild './build rewrite_confs'
cd /usr/local/directadmin/scripts/custom/
echo -n " " > .rewrite_confs

exit 0;

# pico domain_destroy_post.sh
#!/bin/sh

# Cronjob to trigger custombuild './build rewrite_confs'
cd /usr/local/directadmin/scripts/custom/
echo -n " " > .rewrite_confs

exit 0;

# pico subdomain_create_post.sh
#!/bin/sh

# Cronjob to trigger custombuild './build rewrite_confs'
cd /usr/local/directadmin/scripts/custom/
echo -n " " > .rewrite_confs

exit 0;

# pico subdomain_destroy_post.sh
#!/bin/sh

# Cronjob to trigger custombuild './build rewrite_confs'
cd /usr/local/directadmin/scripts/custom/
echo -n " " > .rewrite_confs

exit 0;

# pico user_create_post.sh
#!/bin/sh

# Cronjob to trigger custombuild './build rewrite_confs'
cd /usr/local/directadmin/scripts/custom/
echo -n " " > .rewrite_confs

exit 0;

# pico user_modify_post.sh
#!/bin/sh

# Cronjob to trigger custombuild './build rewrite_confs'
cd /usr/local/directadmin/scripts/custom/
echo -n " " > .rewrite_confs

exit 0;

# pico user_destroy_post.sh
#!/bin/sh

# Cronjob to trigger custombuild './build rewrite_confs'
cd /usr/local/directadmin/scripts/custom/
echo -n " " > .rewrite_confs

exit 0;

# pico rewrite_confs.sh
Code:
#!/bin/sh
# Author: Tim Boormans, Direct Web Solutions
# Email: info [at] directwebsolutions.nl
# Description: This is a workaround for generating working httpd configs
# and is only effective for DirectAdmin on a Debian OS with custombuild.

if [ -f /usr/local/directadmin/scripts/custom/.rewrite_confs ]; then
        cd /usr/local/directadmin/custombuild/
        ./build rewrite_confs

        # make sure there are no errors in the config files
        perl -pi -e 's/Port 80/#Port 80/' /usr/local/directadmin/data/users/*/httpd.conf

        # only reload the configs if they are correct. So a RELOAD
        /etc/init.d/httpd reload

        # remove lockfile
        rm -f /usr/local/directadmin/scripts/custom/.rewrite_confs
fi

exit 0;

# chmod +x *.sh
# chown diradmin:diradmin *.sh
# pico /etc/crontab (add on the last line):
*/2 * * * * root cd /usr/local/directadmin/scripts/custom/; /bin/sh rewrite_confs.sh

After you have done this the tool is working automatically in the background. Every time you add/modify or delete a user/domain/subdomain there will be added a job in the queue of my script, and will be processed within 2 minutes. The only thing you have to make sure is that you have running crond, which is usually installed by default.

# ps ax | grep crond | grep -v grep

If the above command does not show any process, then it is not running, and the script does not work. The default way to start it is:
/etc/init.d/crond start

Mail [email protected] or use the forums if you dont get it started.
 
Back
Top