Los Altos Robotics Plone Server

Apache Configuration Notes

cd /etc/apache2/
sudo a2enmod headers
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
cd sites-available/

# October 10, 2014: I figured out how to use the "RedirectPermanent" command in Apache to tell the world to use a different URL.  This worked well.  Michael
# http://httpd.apache.org/docs/current/mod/mod_alias.html#redirectpermanent 

cat > losaltosrobotics  << EOF

# From http://docs.plone.org/manage/deploying/front-end/apache.html

UseCanonicalName On

<VirtualHost *:80>
    ServerName losaltosrobotics.schuhusa.com
    ServerAlias losaltosrobotics.schuhusa.com
    # Tell the world to use losaltosrobotics.org instead.  The is a permanent redirect.
    RedirectPermanent / http://losaltosrobotics.org/
</VirtualHost>

<VirtualHost *:80>
    ServerName www.losaltosrobotics.org
    ServerAlias www.losaltosrobtics.org
    # Tell the world to use losaltosrobotics.org instead.  The is a permanent redirect.
    RedirectPermanent / http://losaltosrobotics.org/
</VirtualHost>


#NameVirtualHost *
<VirtualHost *:80>
    ServerName losaltosrobotics.org
    ServerAlias losaltosrobotics.org losaltosrobotics.schuhusa.com www.losaltosrobotics.org
    ServerSignature On

    Header set X-Frame-Options "SAMEORIGIN"
    Header set Strict-Transport-Security "max-age=15768000; includeSubDomains"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Content-Type-Options "nosniff"
    Header set Content-Security-Policy-Report-Only "default-src 'self'; img-src *; style-src 'unsafe-inline'; script-src 'unsafe-inline' 'unsafe-eval'"

    ProxyVia On

    # prevent your web server from being used as global HTTP proxy
    <LocationMatch "^[^/]">
      Deny from all
    </LocationMatch>

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    # This turns on the Apache rewrite module.  http://httpd.apache.org/docs/current/rewrite/
    RewriteEngine on
    # The RewriteRule "^/(.*)" sends matches on all paths to the $1.  The "P" flag says to use 
    # the "Proxy" module http://httpd.apache.org/docs/current/rewrite/flags.html#flag_p
    # The "L" says that is the last rule to be processed http://httpd.apache.org/docs/current/rewrite/flags.html#flag_l
    # The VirtualHostBase and other text is interpreted by Zope onwhich Plone runs.  http://docs.zope.org/zope2/zope2book/VirtualHosting.html
    RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/losaltosrobotics.org:80/Main/VirtualHostRoot/$1 [P,L]

</VirtualHost>
EOF

pd ..
a2ensite losaltosrobotics # Tell apache to use the losaltosrobotics configuration file.
service apache2 reload    # Restart the server

Now, both LosAltosRobotics.org and LosAltosRobotics.org:8080/Main work.

Michael
Back to the main Robotics Server Page.