Trixbox change Apache port

 

The idea is to use the apache server on trixbox to host a home page on port 80 other than trixbox’s default home page, but being able to access the latter via an alternate port. I have a static ip address, and without purchasing an additional domain name I wanted to set something like this up for testing purposes. So using Webmin, you must go to servers –> apache webservers
–>click on ‘edit config files’ which allows you to easily edit /etc/httpd/conf/httpd.conf as follows

step 1
Listen 0.0.0.0:80 is the default, so add whatever additional ports that apache is to listen to, eg:
Listen 0.0.0.0:88
Listen 0.0.0.0:99

Step 2. 
Change DocumentRoot from “/var/www/html” to e.g.:
DocumentRoot “/var/www/html2”

Step 3.
Another change:
Directory “/var/www/html2”> (i.e. the same change as above ie was /var/www/html)

Step 4. 
Add the following:
(so typing the [ip address of trixbox computer]:88 is now required to open trixbox)
DocumentRoot /var/www/html

#
(another web browsable option)
DocumentRoot /var/www/html3

allow from all
Options +Indexes

Step 5. 
As an experiment, after unsuccessfully attempting to import existing virtual server settings into the webmin add on ‘virtualmin’, I used virtualmin to set up a virtual server on 192.168.2.10. I found virtualmin used port 80 by default (192.168.2.10:80) along with other default settings, so I changed this to port 90 (192.168.2.10:90) – I also had to add: listen 0.0.0.0:90 – and the following was the resulting httpd.conf file as in ‘edit config’ (please note thatwww.monica.com isn’t my domain – was just used for testing purposes)

#
NameVirtualHost 192.168.2.10:90
–>I later changed to via webmin
SuexecUserGroup “#503” “#503”
ServerName www.monica.com
ServerAlias www.www.monica.com
DocumentRoot /home/www/public_html
ErrorLog /home/www/logs/error_log
CustomLog /home/www/logs/access_log common
ScriptAlias /cgi-bin/ /home/www/cgi-bin/

Options Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All

allow from all

Step 6.
Port forward port 80 via your router to the ip address of the trixbox computer, for the contents of the var/www/html2 dir to be visible on web browsing.

Step 7.
You may need to stop then restart apache via virtualmin main page or via command line instruction, if the expected changes don’t occur. I also found I had to close then re-open the browser.

Leave a comment