By default, Alfresco or any other Tomcat application will run on HTTP port 8080. Because of this, users would need to go to, for example, http://alfresco:8080/share to reach the Alfresco Share website.
We can make this easier by configuring Apache proxy_ajp which will redirect port 80 to Tomcat and will make the "/share" path optional.
Install Apache and enable the necessary modules:
apt-get install apache2
a2enmod proxy_ajp rewrite
Create a virtualhost configuration file at /etc/apache2/sites-available/alfresco-reverse-proxy with the following content:
<VirtualHost *:80>
ServerName alfresco
ErrorLog "/var/log/apache2/alfresco-error.log"
CustomLog "/var/log/apache2/alfresco-access.log" common
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/alfresco*
RewriteCond %{REQUEST_URI} !^/share*
RewriteRule /(.*)$ /share$0 [R]
ProxyPass /alfresco ajp://localhost:8009/alfresco
ProxyPassReverse /alfresco ajp://localhost:8009/alfresco
ProxyPass /share ajp://localhost:8009/share
ProxyPassReverse /share ajp://localhost:8009/share
</VirtualHost>
Disable the default website (if necessary), enable the proxy and restart Apache:
a2dissite 000-default
a2ensite alfresco-reverse-proxy
/etc/init.d/apache2 restart
That's it! Users can now simply type "alfresco" in their browser's address bar and will automatically be redirected to Alfresco Share.
Alfresco will still create links which point to port 8080 though (for example in e-mail notifications), so you should edit /opt/alfresco-4.2.b/tomcat/shared/classes/alfresco-global.properties and set:
alfresco.port=80
share.port=80
Note that administrators can still manage Tomcat using http://alfresco:8080
Finally, you should edit /opt/alfresco-4.2.b/tomcat/conf/server.xml and enable UTF-8 encoding on the AJP connector as following:
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" />
Without this, special characters (non-ascii characters such as é and â) will get mangled in the search forms.
Comments
Dear Joeri,
Dear Joeri,
Thanks for your post. In my test environment this works super!
I wonder if it is also possible to redirect HTTPS to 8443? And if so how does it work (also with certificates).
Regards,
Frank
Hi Joeri,
Hi Joeri,
Thank you very much for your article.
I have Alfresco-5.0.a on Centos 6.4 64 bit (Tomcat web service), my Alfresco doesn't use SSL, my server also run HTTPD service on port 80 for some intranet websites.
I am little bit confuse about :
Disable the default website (if necessary), enable the proxy and restart Apache:
a2dissite 000-default
a2ensite alfresco-reverse-proxy
/etc/init.d/apache2 restart
and
Alfresco will still create links which point to port 8080 though (for example in e-mail notifications), so you should edit /opt/alfresco-4.2.b/tomcat/shared/classes/alfresco-global.properties and set:
alfresco.port=80
share.port=80
I will try to redirect Alfresco to HTTP port 80 to night.