While setting up my new website, I was taking notes to remember things if and when I have to do them again. I am now slowly publishing those notes as blog post in hopes that they turn out to be helpful to someone else as well.
This post is about:
- Debian 8.2
- Apache 2
Tested on cloudscale.ch.
0. ssh into your Debian server
1. Update packages:
sudo apt-get update
2. Install Apache:
sudo apt-get install apache2
Type your server's ip address in your browser's address bar. If Apache is properly installed and working, you will see a default page with the title something like ‘Apache 2 Debian Default Page’
3. Install MySQL:
sudo apt-get install mysql-server php5-mysql mysql-client
3.1 Setup MySQL root password
3.2 Create database directory structure by running:
3.3 Run security script to lock down access:
Enter MySQL root password when asked. Answer 'n' to the first question if you don't want to change your root password. Answer 'y' to the rest of the questions.
3.4 To verify the MySQL server status (at any time) run:
systemctl status mysql
4. Install PHP
sudo apt-get install php5
or with optional additional packages
sudo apt-get install php5 php-pear php5-mysql libapache2-mod-php5 php5-mcrypt
4.1 To test if php is working properly create a basic info.php file:
sudo nano /var/www/html/info.php
This will open a blank file. Enter:
<?php phpinfo(); ?>
Save and close the file.
In your browser visit http://your-server-ip/info.php. You should see PHP info table.
Remove the file:
sudo rm /var/www/html/info.php
5. Default DocumentRoot for Debian 8.2 is /var/www/html. To change it:
sudo nano /etc/apache2/sites-available/000-default.conf
This will open configuration file. Change “DocumentRoot /var/www/html” to what you want it to be, for example, “DocumentRoot /var/www/”.
Restart Apache for the change to take effect:
sudo service apache2 restart
Other posts in the series: