Out-of-memory situation

I'm rather new to the linux environment, but I do have novice experience with most of it.

I am running a Wordpress blog on my server with Apache. The problem is, whenever there is increased traffic, the site crashes.

I contacted support and this is what they said:

> tparker

1 minute ago Hello,

This downtime may be due to an out-of-memory situation. If you look at your console, you will see that your Linode is OOMing, meaning something inside your node is consuming all of the available virtual memory. You can see this for yourself by logging into Lish and viewing the console:

http://library.linode.com/linode-manage … node-shell">http://library.linode.com/linode-manager/using-lish-the-linode-shell

You'll need to identify the culprit and adjust its configuration to prevent it from happening again. An excellent place to start is the Linode Library where you can find documentation on many topics including troubleshooting memory issues:

http://library.linode.com/troubleshooti … networking">http://library.linode.com/troubleshooting/memory-networking

You can also get assistance from our active user community through the forums, IRC channel and our wiki:

http://www.linode.com/community/

Alternatively, if you find that you cannot optimize your configuration any further, it may be wise to purchase additional memory or resize to a larger Linode.

Please let us know if we can be of any additional assistance.

Regards,

Trevor

I have the Linode 512 at the moment. Is there anyway I could configure my server to run more efficiently?

32 Replies

What is MaxClients currently set to? How do 'free -m' and 'ps aux' look?

There aren't as many people on now, but here's the details you asked for:

MaxClients 150

Free M:
> total used free shared buffers cached

Mem: 675 264 411 0 15 97

-/+ buffers/cache: 151 524

Swap: 255 0 255

PS AUX:
> Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 1 0.0 0.2 2736 1596 ? Ss 19:16 0:00 /sbin/init

root 2 0.0 0.0 0 0 ? S 19:16 0:00 [kthreadd]

root 3 0.0 0.0 0 0 ? S 19:16 0:00 [ksoftirqd/0]

root 4 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/0:0]

root 5 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/u:0]

root 6 0.0 0.0 0 0 ? S 19:16 0:00 [migration/0]

root 7 0.0 0.0 0 0 ? S 19:16 0:00 [migration/1]

root 8 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/1:0]

root 9 0.0 0.0 0 0 ? S 19:16 0:00 [ksoftirqd/1]

root 10 0.0 0.0 0 0 ? S 19:16 0:00 [migration/2]

root 11 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/2:0]

root 12 0.0 0.0 0 0 ? S 19:16 0:00 [ksoftirqd/2]

root 13 0.0 0.0 0 0 ? S 19:16 0:00 [migration/3]

root 14 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/3:0]

root 15 0.0 0.0 0 0 ? S 19:16 0:00 [ksoftirqd/3]

root 16 0.0 0.0 0 0 ? S< 19:16 0:00 [khelper]

root 17 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/u:1]

root 21 0.0 0.0 0 0 ? S 19:16 0:00 [xenwatch]

root 22 0.0 0.0 0 0 ? S 19:16 0:00 [xenbus]

root 142 0.0 0.0 0 0 ? S 19:16 0:00 [sync_supers]

root 144 0.0 0.0 0 0 ? S 19:16 0:00 [bdi-default]

root 146 0.0 0.0 0 0 ? S< 19:16 0:00 [kblockd]

root 156 0.0 0.0 0 0 ? S< 19:16 0:00 [md]

root 240 0.0 0.0 0 0 ? S< 19:16 0:00 [rpciod]

root 241 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/2:1]

root 271 0.0 0.0 0 0 ? S 19:16 0:00 [kswapd0]

root 272 0.0 0.0 0 0 ? SN 19:16 0:00 [ksmd]

root 273 0.0 0.0 0 0 ? S 19:16 0:00 [fsnotify_mark]

root 277 0.0 0.0 0 0 ? S 19:16 0:00 [ecryptfs-kthr]

root 279 0.0 0.0 0 0 ? S< 19:16 0:00 [nfsiod]

root 282 0.0 0.0 0 0 ? S 19:16 0:00 [jfsIO]

root 283 0.0 0.0 0 0 ? S 19:16 0:00 [jfsCommit]

root 284 0.0 0.0 0 0 ? S 19:16 0:00 [jfsCommit]

root 285 0.0 0.0 0 0 ? S 19:16 0:00 [jfsCommit]

root 286 0.0 0.0 0 0 ? S 19:16 0:00 [jfsCommit]

root 287 0.0 0.0 0 0 ? S 19:16 0:00 [jfsSync]

root 288 0.0 0.0 0 0 ? S< 19:16 0:00 [xfsmrucache]

root 289 0.0 0.0 0 0 ? S< 19:16 0:00 [xfslogd]

root 290 0.0 0.0 0 0 ? S< 19:16 0:00 [xfsdatad]

root 291 0.0 0.0 0 0 ? S< 19:16 0:00 [xfsconvertd]

root 292 0.0 0.0 0 0 ? S< 19:16 0:00 [crypto]

root 854 0.0 0.0 0 0 ? S 19:16 0:00 [khvcd]

root 967 0.0 0.0 0 0 ? S< 19:16 0:00 [kpsmoused]

root 985 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/0:1]

root 996 0.0 0.0 0 0 ? S 19:16 0:00 [kjournald]

root 1000 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/1:1]

root 1006 0.0 0.0 0 0 ? S 19:16 0:00 [kworker/3:1]

root 1022 0.0 0.1 2500 872 ? S 19:16 0:00 upstart-udev-br

root 1024 0.0 0.0 2368 604 ? S ~~root 1163 0.0 0.0 2364 588 ? S< 19:16 0:00 udevd --daemon

root 1169 0.0 0.0 2364 588 ? S< 19:16 0:00 udevd --daemon

syslog 1905 0.0 0.1 27428 1256 ? Sl 19:16 0:00 rsyslogd -c4

root 1934 0.0 0.1 2428 864 ? Ss 19:16 0:00 cron

root 2016 0.0 0.0 2288 256 ? Ss 19:16 0:00 dhclient3 -e IF

root 2255 0.0 0.1 3600 912 ? Ss 19:16 0:00 /usr/sbin/ntpd

ntpd 2256 0.0 0.1 3496 928 ? S 19:16 0:00 /usr/sbin/ntpd

root 2264 0.0 0.3 5600 2120 ? Ss 19:16 0:00 /usr/sbin/sshd

root 2275 0.0 0.0 0 0 ? S 19:16 0:00 [flush-202:0]

105 2411 0.0 0.1 6700 884 ? Ss 19:16 0:00 /usr/sbin/exim4

root 2489 0.0 1.7 59652 12200 ? Ss 19:16 0:00 /usr/sbin/apach

root 2493 0.0 0.1 2996 964 ? SNs 19:16 0:01 /usr/sbin/prelo

root 2507 0.0 0.0 1840 560 hvc0 Ss+ 19:16 0:00 /sbin/getty -8

mysql 2708 0.0 2.9 131432 20232 ? Ssl 19:17 0:01 /usr/sbin/mysql

www-data 4797 0.1 4.5 69688 31772 ? S 19:35 0:01 /usr/sbin/apach

www-data 5503 0.2 5.6 74708 38904 ? S 19:41 0:02 /usr/sbin/apach

www-data 5542 0.1 4.9 71696 34016 ? S 19:41 0:01 /usr/sbin/apach

www-data 5615 0.1 4.4 68084 30468 ? S 19:42 0:00 /usr/sbin/apach

www-data 5616 0.1 4.4 68340 30580 ? S 19:42 0:00 /usr/sbin/apach

www-data 5868 0.2 5.4 75900 37468 ? S 19:45 0:01 /usr/sbin/apach

www-data 6089 0.1 4.3 68240 29948 ? S 19:47 0:00 /usr/sbin/apach

www-data 6125 0.0 4.0 66096 27956 ? S 19:47 0:00 /usr/sbin/apach

root 6653 0.0 0.4 8540 2804 ? Ss 19:52 0:00 sshd: root@nott

root 6711 0.0 0.1 2052 848 ? Ss 19:52 0:00 /usr/lib/openss

www-data 6784 0.1 3.7 65604 25616 ? S 19:52 0:00 /usr/sbin/apach

www-data 6785 0.2 3.9 66248 27368 ? S 19:52 0:00 /usr/sbin/apach

root 6786 0.0 0.4 8408 2804 ? Ss 19:53 0:00 sshd: root@pts/

root 6878 0.0 0.2 4628 1888 pts/0 Ss 19:53 0:00 -bash

www-data 6961 0.0 1.0 60032 7184 ? S 19:54 0:00 /usr/sbin/apach

root 6962 0.0 0.1 2764 1056 pts/0 R+ 19:54 0:00 ps -aux~~

Take a look at:

~~[http://library.linode.com/troubleshooting/memory-networking#sphapache-2-low-memory-settings" target="blank">](http://library.linode.com/troubleshooti … y-settings">http://library.linode.com/troubleshooting/memory-networking#sph_apache-2-low-memory-settings](

mod_php forces Apache to use a non-optimal method of handling requests, which means you need to lower MaxClients drastically (and probably disable Keepalive) to keep your server from buckling at the slightest increase in traffic.

To pick a random number, try MaxClients 20

Will this allow high traffic?

Alright I changed the apache conf to this

#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# The configuration directives are grouped into three basic sections:
#  1\. Directives that control the operation of the Apache server process as a
#     whole (the 'global environment').
#  2\. Directives that define the parameters of the 'main' or 'default' server,
#     which responds to requests that aren't handled by a virtual host.
#     These directives also provide default values for the settings
#     of all virtual hosts.
#  3\. Settings for virtual hosts, which allow Web requests to be sent to
#     different IP addresses or hostnames and have them handled by the
#     same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "/var/log/apache2/foo.log"
# with ServerRoot set to "" will be interpreted by the
# server as "//var/log/apache2/foo.log".
#

### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at <url:http: httpd.apache.org="" docs-2.1="" mod="" mpm_common.html#lockfile="">);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
# <ifmodule !mpm_winnt.c=""># <ifmodule !mpm_netware.c="">LockFile /var/lock/apache2/accept.lock
#</ifmodule>
#</ifmodule>

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive Off

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

##
## Server-Pool Size Regulation (MPM specific)
## 

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
 <ifmodule mpm_prefork_module="">StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients           20
    MaxRequestsPerChild   0</ifmodule> 

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
 <ifmodule mpm_worker_module="">StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients           20
    MaxRequestsPerChild   0</ifmodule> 

# event MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
 <ifmodule mpm_event_module="">StartServers          2
    MaxClients           20
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxRequestsPerChild   0</ifmodule> 

# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
 <files ~="" "^\.ht"="">Order allow,deny
    Deny from all
    Satisfy all</files> 

#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <virtualhost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <virtualhost>
# container, that host's errors will be logged there and not here.
#
ErrorLog /var/log/apache2/error.log

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

#
# Define an access log for VirtualHosts that don't define their own logfile
CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
Include /etc/apache2/conf.d/

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/</virtualhost></virtualhost></url:http:>

theflame12 wrote:

I have set up a Wordpress blog using Ubuntu 10.04 LTS

It runs, but a couple of scripts don't work here and there and it can be sort of unresponsive at times.

Can someone give me like a guide on how to set up my server to run Wordpress efficiently?

Basically like, how to install PHP, MYSQL, etc. What other things do I need to do to make sure it runs at it's best so that it supports all my scripts, etc.

Please and thanks.

For ease I would use the lamp stack script if you are new to all of this. Then I would install or enable the proformance mods such as,

so the follow ing mods

mod_deflate (compresses files for delivery)

modmemcache (holds you site in heap memory for fast speeds)

mod_expires(leverages browser cache)

mod_pagespeed(still in a sort of beta, but does speed things up)

I would also search for the W3 total cache plugin for wordpress this will speed things up a great deal. I will say that some of the word press components do not like to be cached, for example the "featured post / image thing on the main page of the Arras theme"

I would also go to gtmetrix.com to test yours sites speed and other aspects of your site that will need optimizing.

Other things to concider are;

image size keep this as low as you can without distroying the look of the image, "yahoo smushit" is a great tool for this.

minify the following; (can be done with w3 - total cache, but you will have to enable each thing to be minified one by one to make sure what you minify can be minified.

css

html

php

javascript

and any other scripts that can be as this will speed up your site

Keeps your scripts at the bottom of the page were you can Smile that way the user will see something first and will be only waiting for the background stuff to load.

Try to keep you scripts images and large file size down to a minimum.

and apply the rulles to your .htaccess files to enable the filtering and use of the mods above to you sites content.

I have played around with the setting for apache but I would not suggest this unless you are getting 15k hits a week.

I have a main site with a lot of visual content at

www.zeropointproductionsco.uk and this is wordpress with the above installed.

I have another site that is a work in progress that I am making becuase I want a fast site rather depending on wordpress. using the above I have got the site to load really quick. www.zppwebpress.co.uk

I hope this helps you From James

Hmmm, things still seem the same. Maybe a little faster I guess.

Should I still change my apache conf?

Whats you site url and how many visitor's are you getting ??

I have a friend that uses the techniques to cope with 25k a day in some cases.

It is a difficult thing bench marking sites

ab -n 500 -c 10 http://www.yoursite.com

try that command to see how many pages per second your site can serve, Also did you wipe and start from scratch ?

also these are the setting I have for the keep alive in the apache.conf

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 10

and the max clients

 <ifmodule mpm_event_module="">StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadLimit          64
    ThreadsPerChild      25
    MaxRequestsPerChild   0</ifmodule> 
#Expires headers for Yahoo slow

ExpiresActive On

Site URL:

http://www.clubpenguincheatsy.com/

We average about 1k-6k a day depending on the updates.

Yes. The lamp script didn't seem to be working so I installed Lamp myself with the mods you gave me.

@theflame12:

Will this allow high traffic?

It will, hopefully, allow service to degrade gracefully under high traffic. Instead of trying to fork more processes to handle new requests immediately, it will enqueue them.

As far as site performance goes, something like Chrome's developer tools or Firebug for Firefox will give you a timeline for page loading (right click -> Inspect Element -> Network tab). This is invaluable data for figuring out what to optimize.

So the best thing to do would be to use these settings when I expect high traffic?

Use them all the time. I just looked at your site using page speed and yslow (Firebug extensions for Firefox) and you've got a lot of improvements you can do.

First, you want a faster site, stop loading so much external garbage.

Lol…

External garbage? As in?

Ok well I have ran a test using the gtmetrix site and it would appear that there is still some more optimisation that can be done

http://gtmetrix.com/reports/www.clubpen … m/l4PUuVNY">http://gtmetrix.com/reports/www.clubpenguincheatsy.com/l4PUuVNY

I would get the code right in the site I know that my install of wordpress is not great for this but still when your site fails so badly when using css would suggest to me that the code really does need sorting out in places.

I cannot post the error list on here as I would concider it to be spammy of me to do so.

I really would sort out your css as most of the page speed will be lost in there in your case.

Here is what gtmetrix had to say about your css

http://www.clubpenguincheatsy.com/?bfa_ata_file=css has 254 very inefficient rules, 90 inefficient rules, and 12 potentially inefficient uses of :hover out of 340 total rules.

you also have some scripts that could be further decreased in size,

There are 6 JavaScript files served from pagead2.googlesyndication.com. They should be combined into as few files as possible.

THIS IS THE EXTERNAL GARBAGE ! that waldo talks about I guess

http://pagead2.googlesyndication.com/pa … n_embed.js">http://pagead2.googlesyndication.com/pagead/expansion_embed.js

http://pagead2.googlesyndication.com/pa … raphics.js">http://pagead2.googlesyndication.com/pagead/js/graphics.js

http://pagead2.googlesyndication.com/pa … 719/abg.js">http://pagead2.googlesyndication.com/pagead/js/r20110720/r20110719/abg.js

http://pagead2.googlesyndication.com/pa … ds_impl.js">http://pagead2.googlesyndication.com/pagead/js/r20110720/r20110719/showadsimpl.js

http://pagead2.googlesyndication.com/pagead/show_ads.js

http://pagead2.googlesyndication.com/pagead/sma8.js

These external js files will slow your site loads as it will have to call the css for these parts of your page from another server. I really would put them if possible on your own server.

It does look like at a first glance that you have not got the correct rules in your .htaccess file as well. A you are not utilising the browser cache.

here is what I would expect to see in your .htaccess file after installing and configuring w3 total cache and after installing and configuring the apache2 mods

# BEGIN W3TC Browser Cache
 <ifmodule mod_mime.c="">AddType text/css .css
    AddType application/x-javascript .js
    AddType text/html .html .htm
    AddType text/richtext .rtf .rtx
    AddType image/svg+xml .svg .svgz
    AddType text/plain .txt
    AddType text/xsd .xsd
    AddType text/xsl .xsl
    AddType text/xml .xml
    AddType video/asf .asf .asx .wax .wmv .wmx
    AddType video/avi .avi
    AddType image/bmp .bmp
    AddType application/java .class
    AddType video/divx .divx
    AddType application/msword .doc .docx
    AddType application/x-msdownload .exe
    AddType image/gif .gif
    AddType application/x-gzip .gz .gzip
    AddType image/x-icon .ico
    AddType image/jpeg .jpg .jpeg .jpe
    AddType application/vnd.ms-access .mdb
    AddType audio/midi .mid .midi
    AddType video/quicktime .mov .qt
    AddType audio/mpeg .mp3 .m4a
    AddType video/mp4 .mp4 .m4v
    AddType video/mpeg .mpeg .mpg .mpe
    AddType application/vnd.ms-project .mpp
    AddType application/vnd.oasis.opendocument.database .odb
    AddType application/vnd.oasis.opendocument.chart .odc
    AddType application/vnd.oasis.opendocument.formula .odf
    AddType application/vnd.oasis.opendocument.graphics .odg
    AddType application/vnd.oasis.opendocument.presentation .odp
    AddType application/vnd.oasis.opendocument.spreadsheet .ods
    AddType application/vnd.oasis.opendocument.text .odt
    AddType audio/ogg .ogg
    AddType application/pdf .pdf
    AddType image/png .png
    AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
    AddType audio/x-realaudio .ra .ram
    AddType application/x-shockwave-flash .swf
    AddType application/x-tar .tar
    AddType image/tiff .tif .tiff
    AddType audio/wav .wav
    AddType audio/wma .wma
    AddType application/vnd.ms-write .wri
    AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
    AddType application/zip .zip</ifmodule> 
 <ifmodule mod_expires.c="">ExpiresActive On
    ExpiresByType text/css A31536000
    ExpiresByType application/x-javascript A31536000
    ExpiresByType text/html A3600
    ExpiresByType text/richtext A3600
    ExpiresByType image/svg+xml A3600
    ExpiresByType text/plain A3600
    ExpiresByType text/xsd A3600
    ExpiresByType text/xsl A3600
    ExpiresByType text/xml A3600
    ExpiresByType video/asf A31536000
    ExpiresByType video/avi A31536000
    ExpiresByType image/bmp A31536000
    ExpiresByType application/java A31536000
    ExpiresByType video/divx A31536000
    ExpiresByType application/msword A31536000
    ExpiresByType application/x-msdownload A31536000
    ExpiresByType image/gif A31536000
    ExpiresByType application/x-gzip A31536000
    ExpiresByType image/x-icon A31536000
    ExpiresByType image/jpeg A31536000
    ExpiresByType application/vnd.ms-access A31536000
    ExpiresByType audio/midi A31536000
    ExpiresByType video/quicktime A31536000
    ExpiresByType audio/mpeg A31536000
    ExpiresByType video/mp4 A31536000
    ExpiresByType video/mpeg A31536000
    ExpiresByType application/vnd.ms-project A31536000
    ExpiresByType application/vnd.oasis.opendocument.database A31536000
    ExpiresByType application/vnd.oasis.opendocument.chart A31536000
    ExpiresByType application/vnd.oasis.opendocument.formula A31536000
    ExpiresByType application/vnd.oasis.opendocument.graphics A31536000
    ExpiresByType application/vnd.oasis.opendocument.presentation A31536000
    ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000
    ExpiresByType application/vnd.oasis.opendocument.text A31536000
    ExpiresByType audio/ogg A31536000
    ExpiresByType application/pdf A31536000
    ExpiresByType image/png A31536000
    ExpiresByType application/vnd.ms-powerpoint A31536000
    ExpiresByType audio/x-realaudio A31536000
    ExpiresByType application/x-shockwave-flash A31536000
    ExpiresByType application/x-tar A31536000
    ExpiresByType image/tiff A31536000
    ExpiresByType audio/wav A31536000
    ExpiresByType audio/wma A31536000
    ExpiresByType application/vnd.ms-write A31536000
    ExpiresByType application/vnd.ms-excel A31536000
    ExpiresByType application/zip A31536000</ifmodule> 
 <ifmodule mod_deflate.c=""><ifmodule mod_setenvif.c="">BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html</ifmodule> 
    <ifmodule mod_headers.c="">Header append Vary User-Agent env=!dont-vary</ifmodule> 
    <ifmodule mod_filter.c="">AddOutputFilterByType DEFLATE text/css application/x-javascript text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon</ifmodule></ifmodule> 
 <filesmatch "\.(css|js|css|js)$"=""><ifmodule mod_headers.c="">Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"</ifmodule> 
    FileETag MTime Size
    <ifmodule mod_headers.c="">Header set X-Powered-By "W3 Total Cache/0.9.2.3"</ifmodule></filesmatch> 
 <filesmatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$"=""><ifmodule mod_headers.c="">Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"</ifmodule> 
    FileETag MTime Size
    <ifmodule mod_headers.c="">Header set X-Powered-By "W3 Total Cache/0.9.2.3"</ifmodule></filesmatch> 
 <filesmatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$"=""><ifmodule mod_headers.c="">Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"</ifmodule> 
    FileETag MTime Size
    <ifmodule mod_headers.c="">Header set X-Powered-By "W3 Total Cache/0.9.2.3"</ifmodule></filesmatch> 
# END W3TC Browser Cache
# BEGIN W3TC Skip 404 error handling by WordPress for static files
 <ifmodule mod_rewrite.c="">RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(robots\.txt|sitemap\.xml(\.gz)?)
    RewriteCond %{REQUEST_FILENAME} \.(css|js|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ [NC]
    RewriteRule .* - [L]</ifmodule> 
# END W3TC Skip 404 error handling by WordPress for static files
# BEGIN WordPress
 <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule> 

# END WordPress

 <ifmodule mod_rewrite.c=""># for the re-write of the urls for wordpress

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]</ifmodule> 

# END WordPress

# Set Expires header to current time by default  turn this of while working on the site other wise file name changes will have to be made

ExpiresActive on

#ExpiresDefault "access plus 1 hour"

  <filesmatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"="">ExpiresDefault "access plus 3 days"</filesmatch> 
 <filesmatch "\.(jpg|jpeg|png|gif|swf|bmp|)$"="">ExpiresDefault "access plus 3 days"</filesmatch> 

 <filesmatch "\.(txt|xml|js|css)$"="">ExpiresDefault "access plus 3 days"</filesmatch> 

#disable eTag
FileETag none

#to remove the unwanted errors from the log

#php_flag apc.cache_by_default Off
#php_flag apc.enabled Off

You will have to add some things by hand as well that is why I have place a copy up here for you to check against.

also hoopycat is da man when it comes to this sorta thing he has been very helpful in the past. :)

Hope this helps

I've cut the site load time down by a second, it's just really the Google Ads that seem to be causing a lot of load time.

@theflame12:

I've cut the site load time down by a second, it's just really the Google Ads that seem to be causing a lot of load time.

Yeah I have found in the past they do ad quite a bit of time to the load time of a page. I would defer them to load last and then the content is there first.

get those image sizes down and you should be in fair standing

Optimizing the following images could reduce their size by 58.9KiB (17% reduction).

Losslessly compressing http://cdn.clubpenguincheatsy.com/wp-co … 00x214.png">http://cdn.clubpenguincheatsy.com/wp-content/uploads/2011/08/2011-08-01_112235-300x214.png could save 19.0KiB (17% reduction). See optimized version.

Losslessly compressing http://cdn.clubpenguincheatsy.com/wp-co … 00x213.png">http://cdn.clubpenguincheatsy.com/wp-content/uploads/2011/08/2011-08-01_112216-300x213.png could save 14.2KiB (15% reduction). See optimized version.

Losslessly compressing http://cdn.clubpenguincheatsy.com/image … rships.png">http://cdn.clubpenguincheatsy.com/images/freememberships.png could save 5.9KiB (18% reduction). See optimized version.

Losslessly compressing http://cdn.clubpenguincheatsy.com/image … erteam.png">http://cdn.clubpenguincheatsy.com/images/twitterteam.png could save 3.8KiB (14% reduction). See optimized version.

Losslessly compressing http://cdn.clubpenguincheatsy.com/images/forum.png could save 3.8KiB (32% reduction). See optimized version.

Losslessly compressing http://cdn.clubpenguincheatsy.com/wp-co … 150x51.png">http://cdn.clubpenguincheatsy.com/wp-content/uploads/2011/08/giveaway-logo-150x51.png could save 2.6KiB (21% reduction). See optimized version.

Losslessly compressing http://cdn.clubpenguincheatsy.com/wp-co … 04x150.png">http://cdn.clubpenguincheatsy.com/wp-content/uploads/2011/07/adventure-party-2011-3-104x150.png could save 2.5KiB (13% reduction). See optimized version.

Losslessly compressing http://www.clubpenguincheatsy.com/wp-co … backgr.gif">http://www.clubpenguincheatsy.com/wp-content/themes/atahualpa.3.6.7/atahualpa/images/inputbackgr.gif could save 2.3KiB (49% reduction). See optimized version.

Losslessly compressing http://googleads.g.doubleclick.net/page … cD1M1dqXnJ">http://googleads.g.doubleclick.net/pagead/imgad?id=CPTAw7HZv-PGigEQ-gEY-gEyCAcD1M1dqXnJ could save 1.8KiB (20% reduction). See optimized version.

Losslessly compressing http://cdn.clubpenguincheatsy.com/wp-co … 150x41.png">http://cdn.clubpenguincheatsy.com/wp-content/uploads/2011/07/2011-07-31_134352-150x41.png could save 1.1KiB (6% reduction). See optimized version.

Losslessly compressing http://www.cdn.clubpenguincheatsy.com/w … e-icon.png">http://www.cdn.clubpenguincheatsy.com/wp-content/uploads/2011/06/You-Tube-icon.png could save 636B (12% reduction). See optimized version.

Losslessly compressing http://www.cdn.clubpenguincheatsy.com/w … k-icon.png">http://www.cdn.clubpenguincheatsy.com/wp-content/uploads/2011/06/Facebook-icon.png could save 553B (11% reduction). See optimized version.

Losslessly compressing http://www.cdn.clubpenguincheatsy.com/w … c-icon.png">http://www.cdn.clubpenguincheatsy.com/wp-content/uploads/2011/06/Mac-icon.png could save 512B (12% reduction). See optimized version.

Losslessly compressing http://pagead2.googlesyndication.com/pa … ces_en.png">http://pagead2.googlesyndication.com/pagead/images/adchoicesen.png could save 150B (20% reduction). See optimized version.

Losslessly compressing http://www.google.com/cse/intl/en/image … ermark.gif">http://www.google.com/cse/intl/en/images/googlecustomsearch_watermark.gif could save 39B (2% reduction). See optimized version.

Losslessly compressing http://pagead2.googlesyndication.com/pa … ices_i.png">http://pagead2.googlesyndication.com/pagead/images/adchoicesi.png could save 21B (7% reduction). See optimized version.

I removed the leaderboard ad at the top and the page speed increased quite a bit…

http://gtmetrix.com/reports/www.clubpen … m/u5ZzJ3zZ">http://gtmetrix.com/reports/www.clubpenguincheatsy.com/u5ZzJ3zZ

glad that you have got a faster site now

just follow what that speed testing site tells you and you cannot go far wrong for sure. I would buy the fella a "cup of java" ;)

it took me the best part of a week to get through all the info but was well worth it !

I don't know if this is worth addressing, but when I attempted to compress my existing images with WP Smush it, it gave me "filename is not writable" errors.

@theflame12:

I don't know if this is worth addressing, but when I attempted to compress my existing images with WP Smush it, it gave me "filename is not writable" errors.

Check who owns the image file directory or download them first and then compress them and then re upload them perhaps

I got this error message when trying to upload a file:

"The uploaded file could not be moved to /var/www/wp-content/uploads/2011/08"

Ah kk sounds like the user that you are trying to upload the file with does not have access to the images folder.

ls -l -h

the file that contains the images and then use that user to upload them

infact copy and past what you get from the command and I will further assist

root@li374-118:~# ls -l -h

total 1004K

-rw-r–r-- 1 root root 1000K 2011-05-19 17:25 mod-pagespeed-betacurrentamd64.deb

root@li374-118:~#

@theflame12:

root@li374-118:~# ls -l -h

total 1004K

-rw-r–r-- 1 root root 1000K 2011-05-19 17:25 mod-pagespeed-betacurrentamd64.deb

root@li374-118:~#

ok that is the home dir

you need to list the images folder

use this

cd /var/www/yourworpresssite/wp-content/uplaods/

replacing "yourworpresssite" with the folder name that your site is in

then

ls -l -h

root@li374-118:/var/www/wp-content/uploads# ls -l -h

total 4.0K

drwxr-xr-x 6 root root 4.0K 2011-08-02 05:53 2011

root@li374-118:/var/www/wp-content/uploads#

I'm guessing I have quite a few permission issues going on. A lot of things have been acting weird since I migrated from the shared host.

Yup root owns that file, I would for ease while you get your perms sorted use the following to gain access.

so from the root dir type

cd /var/www/

then

chown -R www-data yoursitesfolder/

replacing the "yoursitesfolder" with the folder of your site

This is not the best way to do this and so you SHOULD change the perms back once you have finished uploading images

using

chown -R root yoursitesfolder/

and to sort the file perms out if you have users uploading content and what not read and refer to this article on the wordpress site

http://codex.wordpress.org/ChangingFilePermissions

Yeah, I have no idea what's going on with the permissions. They were fine as of yesterday. :?

Although I do not do it this way as I only want myself to upload things to the server you can do the following;

make a user that is part of the www-data group and a sudeor and set the file perms to match for the folders you want web users to have access to. and then give ownership of your site to the new sudo user.

This will require that you do some reading of the setting up of users and of the wordpress page I gave you the link for.

TBH if it is only you that is uploading I have found that the most secure way is to change the file perms to www-data for the site while you are working on it and change them back after you have done.

Not that I am paranoid about security :?

TBH it is the server admins preference and what preference of what you want your users of your page to do.

Basically using the method I do usually means that users can make posts, but will not allow them to upload anything

I've changed it and it lets me upload now. Security rly isn't a issue so this should be fine.

Is there a way to change the apache user to root?

is you mean apache user you mean login in with a user and then dropping to root from there in the terminal winodw then you can use

sudo bash

and then input the password for root.

if you mean changing apache to be root then yeah you can but be WARNED this will have some bad effects to your apache server.

TBH I would leave it alone as you may/probably have to install apache again to get your site working again. and also do not do this for mysql either I have done that in the past with a typo and well "server implosion" does not cover the mess it caused

I consider this post to be solved, and I have a busy night ahead so good luck and I hope all of the above has helped.

Good day to you from James

If it ain't broke don't fix it.

Yup, solved for the most part. Thanks for all the help, really appreciate it

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct