depicus

changing the digital world one bit at a time...

Blants (noun) the rants of a blogger

  1. Compress and Expire in Apache2

    February 15, 2016 by The Man

    This is so I can remember and copy/paste next time I need this. Add to your site.con

    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE image/jpg
    AddOutputFilterByType DEFLATE image/png
    AddOutputFilterByType DEFLATE image/gif
    AddOutputFilterByType DEFLATE image/jpeg
    </IfModule>
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access plus 60 days"
    ExpiresByType image/png "access plus 60 days"
    ExpiresByType image/gif "access plus 60 days"
    ExpiresByType image/jpeg "access plus 60 days"
    ExpiresByType text/css "access plus 1 days"
    ExpiresByType image/x-icon "access plus 28 days"
    ExpiresByType application/pdf "access plus 28 days"
    ExpiresByType audio/x-wav "access plus 28 days"
    ExpiresByType audio/mpeg "access plus 28 days"
    ExpiresByType video/mpeg "access plus 28 days"
    ExpiresByType video/mp4 "access plus 28 days"
    ExpiresByType video/quicktime "access plus 28 days"
    ExpiresByType video/x-ms-wmv "access plus 28 days"
    ExpiresByType application/x-shockwave-flash "access 28 days"
    ExpiresByType text/javascript "access plus 7 days"
    ExpiresByType application/x-javascript "access plus 7 days"
    ExpiresByType application/javascript "access plus 7 days"
    </IfModule>


  2. * Starting web server apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName

    April 19, 2013 by The Man

    If you get this error

    * Starting web server apache2
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

    Simply

    sudo sh -c 'echo "ServerName localhost" >> /etc/apache2/conf.d/name' && sudo service apache2 restart

    Update for 13.10 onwards

    sudo nano /etc/apache2/conf-available/servername.conf

    Then add

    ServerName localhost

    to the file and save then

    sudo a2enconf servername

    and finally restart Apache

    sudo service apache2 reload

  3. Run NoSQL (MongoDB) on OS X 10.8 with PHP support

    June 1, 2012 by The Man

    Wow it’s quite easy

    1. Download Mongo from here

    2. Grab the PHP drivers from here

    3. Unzip 2. and move to /usr/lib/php/extensions/no-debug-non-zts-20090626/mongo.so

    4. Edit php.ini and add extension=mongo.so then restart Apache

    5. Start Mongo by extracting the files in 1. then fire up terminal and make a data directory with sudo mkdir -p /data/db for the data then run sudo mongod to run the server.

    6. Head over to here for a basic Hello World

    7. Download MongoHub for a nice, sexy GUI at http://mongohub.todayclose.com – and it’s even on github https://github.com/bububa/MongoHub-Mac – perfect.

    Easy peasy….


  4. Adding a website in OSX for debugging or testing

    December 4, 2011 by The Man

    1. First edit your host file so you have a quick URL to use in your browser

    sudo nano /private/etc/hosts

    2. Edit the Apache config file to add a virtual server

    sudo nano /etc/apache2/httpd.conf

    or if we are on 10.9+ then allow by uncommenting

    Include /private/etc/apache2/extra/httpd-vhosts.conf

    And on 10.10 Yosemite uncomment

    LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

    save then open

    sudo nano /etc/apache2/extra/httpd-vhosts.conf

    and add

    # Depicus Web Site
    
    ServerAdmin anybody@example.com
    DocumentRoot "/Library/WebServer/Depicus/"
    DirectoryIndex index.php
    
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    
    ServerName Depicus
    ErrorLog "/private/var/log/apache2/Depicus-error_log"
    CustomLog "/private/var/log/apache2/Depicus-access_log" common

    3. Restart Apache and you are good to go.

    sudo apachectl -k restart
    

  5. Stop Apache serving .DS_Store files – or any files

    May 19, 2011 by The Man

    If you view or copy files from a Mac to a webserver it will place .DS_Store files in that directory. To fix add in your http.conf or .htaccess file

    
        Order allow,deny
        Deny from all
        Satisfy All
    
    

    Then restart Apache for this to kick in.


  6. Blank page when trying to install Joomla on OSX10.6

    September 10, 2010 by The Man

    If you get a blank page when you try and install Joomla check to make sure you have safe_mode turned off.

    Now safe_mode is set in your php.ini file but also in httpd.conf. The php script below may help you debug a few errors.

    ";
    mysql_select_db("test") or die(mysql_error());
    echo "Connected to Database";
    phpinfo(); 
    ?>