Question

Port Mapping and Apache Virtual Host

  • Posted on August 11, 2014
  • tchangthAsked by tchangth

I would like to maintain port 80 for Apache2 to handle freepbx and sugarcrm portal). how could I set up 000-default.conf? If I can’t use port 80 for 2 portals, can I do port mapping such as 128.168.188.12:8081? Once I port map which part of the firewall must I set up to reflect it? iptables or csf or ufw?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

There are a number of ways to approach this. Do you have a domain name for your server? If so, the best way to serve both FreePBX and SugarCRM on port 80 would be to use subdomains. pbx.yourdomain.com could point to your FreePBX instance while yourdomain.com can point to SugarCRM. This article should point you in the right direction.

If that’s not an option, you can edit your Apache VirtualHost to simply listen on a different port. In your FreePBX’s VirtualHost, just change 80 to 8081

Listen *:8081
<VirtualHost *:8081>
    ServerName pbx.yourdomain.com
    ServerAdmin yourname@yourdomain.com

    ErrorLog /var/log/apache2/freepbx.error.log
    CustomLog /var/log/apache2/freepbx.access.log combined
    DocumentRoot /var/www/freepbx

    <Directory /var/www/freepbx>
        Options Indexes FollowSymLinks MultiViews
        Order allow,deny
        AllowOverride All
        Allow from all
    </Directory>
</VirtualHost>

FreePBX’s will now be available at your.ip.address:8081

As far as firewalling goes, csf and ufw are actually both just wrappers around IP Tables. You just need to open port 8081. With ufw, that would be:

sudo ufw allow 8081/tcp