The original guide for
Debian 5, 6, 7
Part 2
Now the fun part
I'm going to suggest Apache2 with php-fpm and standard MySQL.
Mostly because you're new and setting up nGinx isn't for the faint of heart. But also for the life of you... I don't think you'll want to re-configure and re-write rules for every 3rd party change or add-on you'll add for either XenForo, Word Press, or anything else for that matter.
STEP 2
If you did or needed to reboot a 2nd time, follow the same update and full-upgrade until everything reports there are no update.
Now after you're completed this.... The fun begins
PHP:
aptitude install mysql-server mysql-client
Normally during the install, you will be asked to provide a MySQL Root Password. This is important to NEVER use the MySQL root (if you can help it), but also important to NEVER forget this password either. Make this password long and not easy to guess.
If for some odd reason the install
didn't ask you to add a password.....
Immediately after you have installed the mysql server, you should change its root password
PHP:
/usr/bin/mysqladmin -u root password 'enter-your-good-new-password-here'
You must never use your root account and password when running databases.
The root account is a privileged account which should only be used for admin procedures. You will need to create a separate user account to connect to your MySQL databases from a PHP script. You can add users to a MySQL database by using a control panel like phpMyAdmin to easily create or assign database permissions for users.
I can not stress enough how many people are stupid and end up using the root name and password.
Don't do it.
Now let's install and setup Apache2
PHP:
aptitude install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils
Type in your server's IP address (inside your web browser) .... You should see a nice Apache page (typically says, IT WORKS!)
Now let's install PHP
PHP:
aptitude install php5 php5-fpm libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
The above should allow you to run every possible modification you will find on XenForo. Although you can add php5-geoip if you plan on using it or if you feel it is required, but it does use up some resources.
Let's see if php is working
PHP:
a2enmod rewrite
a2enmod include
PHP:
/etc/init.d/apache2 restart
We're going to make a simple php test file
PHP:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
Name that file as anything you want, as long as it ends with
.php
Upload it to:
/var/www/
Type in your servers IP address and add the path to that file
Example = 192.168.1.1/FileName
.php
If you see your PHP details all is working
Now
DELETE that file. It's not really a good idea to keep it on your server.
Now let's install a few random things you may find you'll need.
PHP:
aptitude install curl perl libapache2-mod-perl2 python libapache2-mod-python ntp ntpdate
Now lets restart apache2 again (to load all this). The above adds curl, perl, python, and keeps your site time up to date.
PHP:
/etc/init.d/apache2 restart
At this point, depending on your web host... You maybe simply able to type in your domain name and see that nice Apache2 page without typing in your IP address.
Thankfully most host (even unmanaged host) have an internal dns / bind system. So configuring or installing such isn't required. And saves you resources and helps limit security threats. Be so thankful for our ever-changing world of technology.
If this is not the case for you.... I'd think about finding another host.
Seriously.
Now you need to make a choice
1) Is this the only domain you will be having on this server
OR
2) Will have other domain names and / or sub domain names
If option 1 .... Congratulations, you're done.

Pat yourself on the back. Wasn't that easy?
The following will allow you to work with phpMyAdmin
PHP:
aptitude install phpmyadmin
You'll be asked if you want phpMyAdmin to make its own database, say NO
PHP:
/etc/init.d/apache2 restart
The user name and password will be your root and password. For this reason,
do not leave phpMyAdmin installed. Use it only for how long you need it and then remove it. That is my advise to you.
If you follow my advise, you will need to do the follow below (
if you do not follow my advice, at least password protect it using
.htaccess as an extra level of security. But remember, I warned you)
A whole guide to
htaccess can be found on Apache's own web site:
http://httpd.apache.org/docs/2.0/howto/htaccess.html
PHP:
aptitude remove phpmyadmin
PHP:
aptitude purge phpmyadmin
PHP:
/etc/init.d/apache2 restart
If option 2 .... A little more work for you....
OPTION 2
So you've decided you want more and thus continued to
option 2
Configure Apache module userdir in /etc/apache2/mods-enabled/userdir.conf
PHP:
nano /etc/apache2/mods-enabled/userdir.conf
PHP:
<IfModule mod_userdir.c>
UserDir public_html
UserDir disabled root
<Directory /home/*/public_html>
AllowOverride All
Options MultiViews Indexes SymLinksIfOwnerMatch
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
</IfModule>
Create directory as
user (not as root)
PHP:
mkdir /home/$USER/public_html
Change group as root (substitute your username) and restart web server
PHP:
chgrp www-data /home/<username>/public_html
If you get a Forbidden error when accessing home folder through apache check /home/username has permissions drwxr-xr-x. If the permissions are wrong correct them as such:
PHP:
chmod 755 /home/<username>
Next we need to change something for PHP to work this way
PHP:
nano /etc/apache2/mods-available/php5.conf
PHP:
<IfModule mod_php5.c>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#<IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_value engine Off
# </Directory>
#</IfModule>
</IfModule>
See little instruction note in that? Follow it
Save and exit
PHP:
/etc/init.d/apache2 restart
Done
