If you have installed Alfresco using the default settings, most likely the server is accessible through the port 8080, and now you might be wondering how can you access the server using port 80 or 443 instead. There are many options how to accomplish that if you use Google to find answers, but I’ll write down what I believe is the quickest and most efficient way to accomplish that in this tutorial.
I’m using CentOS 7 and Alfresco 5 for this DEMO, but it should work in any other Linux distribution like Ubuntu and multiple versions of Alfresco as well. If you have Alfresco installed on a Windows server, I can’t guarantee this tutorial will work, but you can give it a try and see. Also, if you are using a Windows Server to host your Alfresco server, you can do the Apache proxy on a separate Linux server. In my opinion, Apache in Windows is not as reliable.
OK let’s dive in.
When you install Alfresco, only the Tomcat web server gets installed, so if you haven’t installed Apache yet, that’s the first thing you need to do. In CentOS 7 you can install Apache by running this command in terminal”
sudo yum install httpd
That command should install everything you need for this configuration in CentOS 7. To make Apache to automatically start when your reboot the server run these commands:
sudo systemctl enable httpd.service sudo systemctl restart httpd.service
To install Apache in Ubuntu run these commands in the terminal:
sudo apt-get install apache2 sudo a2enmod proxy sudo a2enmod proxy_ajp
Now, navigate to your Apache configuration directory, and create a custom virtual host. the path to Apache config directory in CentOS is
In Ubuntu is:
I named my virtual host “alfresco.conf”
Once you have created the Virtual Host copy and paste these settings. The things you need to change are marked with ( change this )
ServerAdmin [email protected] ( change this ) ServerName alfresco.domain.com ( change this ) ServerAlias www.alfresco.domain.com ( change this ) SSLEngine On SSLCertificateFile /path-to-your-cert ( change this ) SSLCertificateKeyFile /path-to-your-cert-key ( change this ) SSLCertificateChainFile /path-to-your-cert-chain ( change this ) ServerAdmin [email protected] DocumentRoot /var/www/html ServerName alfresco.domain.com ( change this ) ServerAlias www.alfresco.domain.com ( change this ) AddDefaultCharset Off Order deny,allow Allow from all ProxyPass /alfresco/down.html ! ProxyPass /alfresco ajp://localhost:8009/alfresco ProxyPassReverse /alfresco ajp://localhost:8009/alfresco ProxyPass /share ajp://localhost:8009/share ProxyPassReverse /share ajp://localhost:8009/share ErrorDocument 503 /alfresco/down.html Order Deny,Allow Allow from all Satisfy Any RedirectMatch ^/$ /share/ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog /var/log/httpd/error.log # CustomLog /var/log/httpd/requests.log combined CustomLog /var/log/httpd/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf
Once you have created the Virtual Host with all the proper information. in CentOS just simply restart Apache:
sudo systemctl restart httpd.service
Now test your server using port 80 or 443
In Ubuntu, you need to enable the virtual host using this command:
sudo a2ensite alfresco.conf
And then restart Apache:
sudo service apache2 restart
Virtual Host Overview
Let’s go over the Virtual Host stuff in more details so you have a better understanding what’s going on here. The critical piece in the Virtual Host is this:
ProxyPass /alfresco/down.html ! ProxyPass /alfresco ajp://localhost:8009/alfresco ProxyPassReverse /alfresco ajp://localhost:8009/alfresco ProxyPass /share ajp://localhost:8009/share ProxyPassReverse /share ajp://localhost:8009/share ErrorDocument 503 /alfresco/down.html
What this does is, when Apache receives a request on port 80 or 443 it proxies that request to Alfresco listening on port 8009. the AJP port 8009 is created by default when you install Alfresco, so unless you intentionally closed that port, it should be opened by default.
This two entries:
ProxyPass /alfresco/down.html ! ErrorDocument 503 /alfresco/down.html
is a static HTML page I created to alert users when Alfresco goes down for some reason. as you can see, that page is in this path:
and this is what is on the page:
Download page from here
If you notice, There are two Virtual Host entries. One for 80 and the other 443. You can force all traffic coming to port 80 to 433 or remove the “443” entry if you don’t want to use a secure connection.
I hope this is a help to you.
0 people found this helpful
0 people found this helpful