WordPress over Lighttpd + APC in Squeeze (II and final)


Here again with the story of Lighty and WordPress !. If you haven't read the Part I of this series, then he still has nothing to do around here. Read and study its content and then come back. To finish the installation and configuration of the couple, we have to do:

  • Install WordPress: create the database and user in MySQL and grant it the necessary privileges; create and modify the configuration file wp-config.php according to the connection with the database; and finish the WordPress installation through its web interface.
  • Improve cache by Alternative PHP Cache.

Install WordPress

Let's delete the file index.php created earlier for checking our configuration:

rm /srv/web.amigos.cu/htdocs/index.php

Through Nautilus or Terminal, we copy the WordPress installation file to the root directory of the documents, in this case we would copy it to/srv/web.amigos.cu/htdocs/.

Note: Let's assume we have WordPress version 3.4.1 for this tutorial.

After copying, we go to that directory and unzip, and move all the contents of the directory wordpress to / htodcs / and we delete the installer:

cd /srv/web.amigos.cu/htdocs tar xvfz wordpress-3.4.1-es_ES.tar.gz mv wordpress / *. rm -r wordpress / wordpress-3.4.1-es_ES.tar.gz chown -R www-data. * chmod -R + x * .php

We create the user and the database in the MySql: Through a terminal we connect to the administration console, we execute mysql -p, and after entering our password, we execute the necessary SQL queries:

mysql -p Enter password: Welcome to the MySQL monitor. Commands end with; or \ g. Your MySQL connection id is 40 Server version: 5.1.49-3 (Debian) [---] CREATE USER 'myuser' IDENTIFIED BY 'myipassword'; CREATE DATABASE IF NOT EXISTS `wp_friends`; USE friends_wp; GRANT ALL PRIVILEGES ON `amigos_wp`. * TO 'myuser' @ '%' WITH GRANT OPTION; quit

EYE with quotation marks when we use them to enclose the name of the database between them. Notice what is `friends_wp` and not 'amigos_wp'.

We create and modify the wp-config.php file:

cd /srv/web.amigos.cu/htdocs cp wp-config-sample.php wp-config.php nano wp-config.php

The only lines that we must modify are:

// ** MySQL settings. Request this data from your web host. $ / ** The name of your WordPress database * / define ('DB_NAME', 'amigos_wp'); / * Your MySQL username * / define ('DB_USER', 'myuser'); / ** Your MySQL password * / define ('DB_PASSWORD', 'mipassword');

We leave the rest of the file intact. We save the changes.

Final installation settings: We refresh the page in our browser (http://web.amigos.cu) and we are already in the famous 5-minute WordPress installation process !.

Be imaginative and creative. Fill in the fields requested by the installer according to your needs. If your site is facing the Internet (heavily protected by a Firewall) you can allow search engines like Google and others to index it. As mine is for the Enterprise LAN only, I uncheck that option and click on the magical "Proceed" button.

The other steps are typical of WordPress and the truth is that I am not the one to help you use it at all. Consult the manual or ask others who are already experts in its use.

We improve the cache of the intermediate code in PHP using APC:

For the record, I am NOT saying it! KBeezie says so in an article titled “The Importance of Caching WordPress”(The Importance of Cache in WordPress) when he states:

"WordPress, in all its glory ... is a damn sloppy hog"

Which in a rough translation means that "WordPress in all its glory ... is a bloody sloppy pig." We recommend reading this very interesting and educational article. There are several ways to improve the WordPress cache according to specialized documentation, either through "W3 Total Cache", "WP Super Cache", and others. If we run

aptitude show php-apc

we will obtain a brief description, which freely translated says:

“The Alternative PHP Cache, also known as APC, is an open source, free and robust framework for caching and optimizing intermediate PHP code. APC is a quick solution to establish a local cache of PHP code. It is not distributed like MencacheD, but it can be used together to obtain an optimal cache ”. To install it we execute:

aptitude install php-apc

Later, we read the files /usr/share/doc/php-apc/README.Debian and ALL from the same folder. According to what is recommended in the first one, we do the following:

gunzip /usr/share/doc/php-apc/apc.php.gz cp /usr/share/doc/php-apc/apc.php /srv/web.amigos.cu/htdocs/ chown www-data: root / srv / web.amigos.cu / htdocs / apc.php chmod + x /srv/web.amigos.cu/htdocs/apc.php

We must declare a password in the file apc.php to make it fully work. We edit the file that is already in the root /htdocs/apc.php, we go to line 41 and find:

defaults ('ADMIN_USERNAME', 'apc'); defaults ('ADMIN_PASSWORD', 'password');

The 'password' must be changed to an own password that is not the word Password. We save the changes and before doing anything else we must restart the service:

service lighttpd restart

We point our browser to the URL web.amigos.cu/apc.php and we will see how the alternative PHP cache is working.

Friends, I hope everything written will be of some use to you. See you on the next adventure!

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

4 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   eliotime3000 said

    Nice tutorial.

    One suggestion: And why don't you use apt-get?

    1.    Federico A. Valdes Toujague said

      Thanks for your comment. I use aptitude out of habit. From Sarge or Debian 3.

    2.    Federico A. Valdés Toujague said

      Thank you very much for your comment. I use aptitude out of habit since Debian 3.0 or Sarge. There are no more mysteries.

      1.    eliotime3000 said

        Ah already. I use apt-get because if I use aptitude it might spoil the graphical environment (I already did the test in stable and it threatened to get rid of GNOME and other things) and that way it is much safer.