giovedì 14 giugno 2012

Migrate PhpBB3 on Ubuntu server

PhpBB version: 3.0.9
Backend: Mysql
Mode: Fcgi



Dump the database

ubuntu~# mysqldump -u root -p phpbb3 > /tmp/phpbb3.sql


On the new machine

new~# apt-get update && apt-get install phpbb3


During the installation, choose to configure mysql/phpbb3 via debconf and answer about passwords in this order
* Mysql root password
* Phpbb3 database password
* Phpbb3 admin interface password

Afterwords, setup the web server. You have a configuration example in /etc/phpbb3/apache2.conf; you can directly copy this file in your /etc/apache2/sites-available directory and run

new:/etc/phpbb3# cp apache2.conf /etc/apache2/sites-available/phpbb3
new:/etc/phpbb3# cd /etc/apache2/sites-available/
new:/etc/apache2/sites-available# a2ensite phpbb3 && service apache2 reload


Try to login and surf the admin interface (APC). If you had a custom theme in the previous server, do the follow:

ubuntu~# scp -r /srv/phpbb3/theme/ (or wherever it is) new:/usr/share/phpbb3/styles


Important , make a sym link in /etc/phpbb3/styles directory to make phpbb see the custom theme

new~# cd /etc/phpbb3/styles
new:/etc/phpbb3/styles# ln -s /usr/share/phpbb3/styles/theme theme


Once the link is ok, configure the new theme in the APC (administrative panel)

If everything seems to be fine, move on and restore the database

new~# mysql -u root -p phpbb3 < phpbb3.sql


Configure FCGI

new~# apt-get install php5-cgi
new~# cd /etc/apache2/
new:/etc/apache2/# a2dismod php5
new:/etc/apache2/# service apache2 restart


Setup fcgi environment

new~# cd /srv (or wherever you'll locate it)
new:/srv# mkdir php-fcgi
new:/srv# cd (alt+.)
new:/srv/php-fcgi# ls
phpbb.fcgi
phpbbrc -> /etc/php5/cgi/


phpbb.fcgi

#!/bin/sh
PHP_FCGI_MAX_REQUESTS=10000
PHP_FCGI_CHILDREN=0
export PHPRC=/srv/php-fcgi/php53rc
export PHP_FCGI_MAX_REQUESTS PHP_FCGI_CHILDREN
# Replace with the path to your FastCGI-enabled PHP executable
exec /usr/bin/php-cgi


NOTE: phpbbrc is a link to /etc/php5/cgi/ directory

The virtualhost section should be something like

<VirtualHost *:80>
    ServerName forum.example.org
    DocumentRoot /usr/share/phpbb3/www
    ErrorLog /var/log/apache2/forum_error.log
    CustomLog /var/log/apache2/forum_access.log combined
    Alias / /usr/share/phpbb3/www/

   <Directory>
      Order allow,deny
      Allow from all
      Options +ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper /srv/php-fcgi/phpbb.fcgi .php
   </Directory>
</VirtualHost>



Try to load a forum page and check with

new~# ps ax | grep cg[i]
2248 ? S 0:00 /usr/bin/php-cgi


that php-cgi is running ..

Nessun commento:

Posta un commento