How to setup a VPS (or Dedicated Server) with Nginx from scratch

In this tutorial we are going to go through the steps of securing the server and configuring Nginx, PHP, Phpmyadmin and MySql.

Step 1. Basic Security

Assuming you have already logged into your server we start by changing the root password to something more secure.

passwd

 

This will prompt you to change the root password, It is recommended to choose something extremely complex as it is your most crucial line of defence against the outside world.

Next, open up the ssh config

vim /etc/ssh/sshd_config

and change the port from 22 to anything between 1025 to 65536, this will prevent our server from being easily spotted by malicious eyes (more…)

Continue Reading

How to enable .htaccess in apache

Step 1.

cd /etc/apache2/sites-available

Step 2.

vim default (or default-css)

Step 3. Change AllowOverride from ‘None’ to ‘All’

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride All    <---- replace None with All
    </Directory>
    <Directory /var/www >
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All   <---  replace None with All
            Order allow,deny
            allow from all
    </Directory>

Step 4. Enable Mod Rewrite

sudo a2enmod rewrite

5. Restart Apache

service apache2 restart

You are now done…

Sample .htaccess…

(more…)

Continue Reading
Close Menu