Tag Archives: WordPress

Apache2 – WordPress & Gallery solutions

If Apache server status page http://zviretnik.eu/server-status error 403 page not found appear, the solution could be modification of .htaccess file of WordPress. Mode rewrite has to have following rule:

# Stop Processing if you see server-info or server-status
RewriteRule ^(server-info|server-status) - [L]
# The Rewrite Condition below did not work
# RewriteCond %{REQUEST_URI} !=/server-status

Don’t forget, that server status is accessible mostly only from localhost. If you want to change it, you have to edit /etc/apache2/mods-enabled/status.conf (Allow from localhost).

In case you upgrade to Apache2, it may happen that your Gallery 3 show following error message when you try to change permission on album or photo:

Oh no! Your server needs a configuration change in order for you to hide photos! Ask your server administrator to enable mod_rewrite and set AllowOverride? FileInfo? Options to fix this.

If you have mode rewrite enabled (a2enmod rewrite) and your virtual host directory configuration already contain “AllowOverride FileInfo Options“, than problem could be in your /etc/hosts file. The localhost entry has to have also FQDN name of your server, for example:

127.0.0.1       localhost       zviretnik.eu

Installing WordPress on Ubuntu

http://www.ubuntugeek.com/installing-wordpress-3-0-on-ubuntu-10-04-lucid-lynx.html

Installation
apt-get install apache2 libapache2-mod-php5 mysql-server php5-mysql php5-curl php5-gd libssh2-php

cd /var/www/
wget http://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
ls -la
chown -R www-data:www-data wordpress
rm -f latest.zip

Apache
/etc/apache2/sites-available/wordpress.conf

<VirtualHost *:80>
        ServerAdmin my@email.com
        ServerName www.example.org
        ServerAlias example.org
        DocumentRoot /var/www/wordpress

        Redirect permanent / https://www.example.org/

        ErrorLog /var/log/apache2/example.org-error.log

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

        CustomLog /var/log/apache2/example.org-access.log combined
</VirtualHost>

/etc/apache2/sites-available/wordpress-ssl.conf

<VirtualHost *:443>
        ServerAdmin my@email.com
        ServerName www.example.org
        ServerAlias example.org
        DocumentRoot /var/www/wordpress/

        <Directory /var/www/wordpress>
                Options -Indexes +FollowSymLinks +MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
                DirectoryIndex index.php
        </Directory>

        Alias /wordpress /var/www/wordpress

        ErrorLog /var/log/apache2/example.org-ssl-error.log

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

        CustomLog /var/log/apache2/example.org-ssl-access.log combined

        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
        SSLCertificateFile /etc/ssl/example.org.cer
        SSLCertificateKeyFile /etc/ssl/private/example.org.key
        SSLCertificateChainFile /etc/ssl/startssl.sub2.ca.pem
        SSLCACertificateFile /etc/ssl/startssl.root.cs.pem
        SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

        CustomLog /var/log/apache2/example.org-ssl-request.log \
         "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

/var/www/wordpress/.htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Activate both new sites and modules:

a2ensite wordpress wordpress-ssl
a2enmod ssl rewrite headers

MySQL

mysql -u root -p
SHOW DATABASES;
SELECT User FROM mysql.user;
DROP DATABASE drupal6;
DELETE FROM mysql.user WHERE User=`drupal6`;
CREATE DATABASE `wp_db`;
CREATE USER `wp_user`;
SET PASSWORD FOR 'wp_user' = PASSWORD('mysecretpassword');
GRANT ALL PRIVILEGES ON `wp_db`.* TO 'wp_user'@'localhost' IDENTIFIED BY 'mysecretpassword';
FLUSH PRIVILEGES;
EXIT
rm -f ~/.mysql_history

service mysql restart

Configuration

cd /var/www/wordpress
cp wp-config-sample.php wp-config.php
chown www-data:www-data wp-config.php

/var/www/wordpress/wp-config.php

    DB_NAME: Database Name used by WordPress
    DB_USER: Username used to access Database
    DB_PASSWORD: Password used by Username to access Database
    DB_HOST: The hostname of your Database Server

https://api.wordpress.org/secret-key/1.1/salt/

    AUTH_KEY
    SECURE_AUTH_KEY
    LOGGED_IN_KEY
    NONCE_KEY

service apache2 restart

http://your.domain/wp-admin/install.php