The Ultimate Media Server - Apache+SSL , PHP, MySQL and Jinzora - Page 3

References

This document was created using a number of different website and applications. If you care to expand your knowledge about the base server or the applications used, here are a few links to get you started.

http://www.jinzora.com

http://www.daemonnews.org/

http://www.freebsd.org

http://www.freebsddiary.org/

http://httpd.apache.org/

http://dev.mysql.com/doc/

http://www.php.net/

Server Configuration Tips/Living Document

This part of the document I like to refer to as the Tweaks section or Living Document section because it will surely be changing as advances or tweaks are made and comments come in from the general public. First and foremost I would surely visit the Tips and Tweaks Jinzora forum every now and again for the latest and greatest discoveries.

1) By default apache logs to one file and there is this big misconception that it is a very difficult task to rotate the logs at a specific time or given interval to keep one single file from growing enormously and being hard to manage. Every version of apache comes with rotatelogs , on this machine you will find it in / usr/local/sbin/rotatelogs . You will need to edit your / usr/local/etc/apache/httpd.conf and comment out these lines

CustomLog / var/log/httpd-access.log combined

TransferLog / var/log/httpd-access.log

To look like

CustomLog "| rotatelogs / var/log/apachelog 86400" combined

TransferLnsferLog "| rotatelogs / var/log/apachelog 86400''

This is basically using an external program bundled with apache and doing what is called piped logging and rotating your log file ever 24 hours. More details can be found in the Apache Documentation.

2) I would recommend that before installation of jinzora that you organize you media/mp3's in the format of /genre/artist/album title/track. Then during installation of jinzora make sure you choose the file system base installation and not the id3 base installation doing it this way will give you speed advantages and better control vice using the id3 format. Not to mention if you are not good about ripping your cd's and making sure the id3 tags are right you will end up with one slow install and a mess of a website.

3) During installation of php at the very end you were told to copy /usr/local/etc/php.ini-dist to /usr/local/etc/php.ini make sure that you do not skip this step. PHP is a very important part to Jinzora as it is written in this language. I have noticed on very large installations of Jinzora meaning a site with what I would classify as large being over 5Gig in media data, that you will need to make changes to this file. After copying the above file you will need to make sure that you edit it and change the section you see below. Of course these are the parameters I use and are dependent on how much memory you have in your machine so these parameters may not be optimal for you. My machine has 1gig of memory and this has turned out to be the sweet spot for me and Jinzora simply screams.

;;;;;;;;;;;;;;;;;;;

; Resource Limits ;

;;;;;;;;;;;;;;;;;;;

max_execution_time = 300 ; Maximum execution time of each script, in seconds

max_input_time = 60 ; Maximum amount of time each script may spend parsing request data

memory_limit = 64M ; Maximum amount of memory a script may consume (8MB)

4) By default MySQL will run great but there are some tweaks that I have found to be very helpful especially in reference to speeding up jinzora . MySQL has included four template files that you can use for tweaking, they are

my- huge.cnf , my- large.cnf , my- medium.cnf , my- small.cnf these file reference the type of system you have just installed MySQL on and the type of utilization you expect the database to handle. I copied the / usr/local/share/mysql/my-medium.cnf file to / var/db/mysql/my.cnf which is where MySQL will expect to find this file for use. I then made the following tweaks to this file and MySQL which can be seen below. But before tweaking this file I recommend that you at least read the Getting Started MySQL documentation because if you are not sure what it is you are doing you can bring your system to it's knees with the wrong values. The AdminZone has a very popular thread about tweaking MySQL for speed also but is starting to age a bit. But thats ok because a quick google search for this topic would give you plenty of information.

Configuration changes I made to my my.cnf file that really made a speed difference in Jinzora

key_buffer = 64M

max_allowed_packet = 16M

table_cache = 1024

join_buffer_size = 2M

sort_buffer_size = 4M

read_buffer_size = 2M

myisam_sort_buffer_size = 64M

thread_cache = 8

# Try number of CPU's*2 for thread_concurrency

thread_concurrency = 2

max_connections = 200

max_user_connections = 200

query_cache_limit = 1M

query_cache_size = 32M

query_cache_type = 1

5) Make a few apache tweaks for low utilized sites so it does not eat up so many resources, though the default is good I prefer to change a couple of settings.

# vi / usr/local/etc/apache/httpd.conf

# KeepAliveTimeout 5

# MaxClients 75

# ServerAdmin [email protected]

# ServerName www.yourdomain.com

This setting is Default but make sure it is set this way so that apache does not use resources or get bogged down trying to host lookups for everyone that visits your site.

# HostnameLookups Off

Also when starting apache with SSL you will be prompted to enter the password you used when creating the key. The reason you have to do this every time is because the key is stored in an encrypted format. *****One BIG thing to note here is that upon reboot the box will NOT boot up all the way until you put in the pass phrase.***** So if this box is hosted remotely and you have no console to it I would recommend getting console access to it via some console server. If this is not possible then as a last resort you can remove the encryption off the key. But please know that this is not recommended as anyone with access to the server if it is not secure can get your key and impersonate you. If you are sure you wish to do this then follow the steps below.

# cd / usr/local/etc/apache/ssl.key
# cp server.key server.key.orig
# openssl rsa -in server.key.orig -out server.key

6) During this installation all these packages were installed from the ports packages. I had tried to include in this documentation the process for upgrading all ports packages with CVS before installing but it turned out way to long. The FreeBSD Handbook has a very easy walk through of installing cvs and for upgrading ports. But I have custom wrote some a few simple scripts that makes this process a little easier which will be in a different document to come. So stay tuned and keep check for the FreeBSD Upgrading Ports document at http://www.digitalrage.org

Questions/Comments

Drop me a line

This document written and maintained by Elijah Savage at http://www.digitalrage.org with OpenOffice 2.0 and exported to PDF ,Doc , and rtf formats for versatility and ease of use for the end user. OpenOffice what a great app.

Download this Document

PDF Format

Word 97/2000/XP Doc Format

OpenOffice Format

Rich Text Format

Revisions

Rev1. Upgrading FreeBSD Doc created and linked to from this document.

Share this page:

0 Comment(s)