Tuesday, June 10, 2014

Ubuntu Configuration Example

<VirtualHost *:80>
        ServerName example.com
        ServerAlias www.example.com

        WSGIDaemonProcess natenesler.com python-path=/home/ubuntu/public_html/example.com/example:/usr/local/lib/python2.7/site-packages/
        WSGIProcessGroup example.com

        # AliasMatch ^/([^/]*\.css) /home/ubuntu/public_html/example.com/example/example/static/styles/$1

        Alias /media/ /home/ubuntu/public_html/example.com/example/example/media/
        Alias /static/ /home/ubuntu/public_html/example.com/example/example/static/

        <Directory /home/ubuntu/public_html/example.com/example/example/static>
          <IfVersion < 2.3 >
               Order allow,deny
               Allow from all
          </IfVersion>
          <IfVersion >= 2.3>
               Require all granted
          </IfVersion>               
        # Order deny,allow
                # Allow from all
                # Apache 2.4 requires following below in place of
                # Allow from all
                # Require all granted
        </Directory>

        <Directory /home/ubuntu/public_html/example.com/example/example/media>
                <IfVersion < 2.3 >
                        Order allow,deny
                        Allow from all
                </IfVersion>
                <IfVersion >= 2.3>
                        Require all granted
                </IfVersion>               
                # Order deny,allow
                # Allow from all
                # Apache 2.4 requires following below in place of
                # Allow from all
                # Require all granted
        </Directory>

        WSGIScriptAlias / /home/ubuntu/public_html/example.com/example/example/apache/wsgi.py

        <Directory /home/ubuntu/public_html/example.com/example/example/apache>
                <Files wsgi.py>
                    <IfVersion < 2.3 >
                            Order allow,deny
                            Allow from all
                        </IfVersion>
                    <IfVersion >= 2.3>
                            Require all granted
                    </IfVersion>               
                        # Order allow,deny
                    # Allow from all
                        # Apache 2.4 requires following below in place of
                        # Allow from all
                        # Require all granted
                </Files>
        </Directory>


        ErrorLog ${APACHE_LOG_DIR}/error-example.com.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access-example.com.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        <IfVersion < 2.3 >
            Order allow,deny
            Allow from all
        </IfVersion>
        <IfVersion >= 2.3>
            Require all granted
        </IfVersion>               
        # Order deny,allow
        # Deny from all
        # Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

No comments:

Post a Comment