Top Left Text cha

Website Development Services

Update software
apt-get update && apt-get upgrade

You will be prompted to update or keep local copy of grub... keep the local copy!
Create hostname
hostnamectl set-hostname example
(replace 'example' with something new. Doesn't matter what you call it)

Edit /etc/hosts

Example:
127.0.0.1 localhost
45.79.74.179 example-domain.com example-hostname
2600:3c01::f03c:91ff:fea5:187e example-domain.com example-hostname
(ipv6 is optional)

Set Time Zone

List time zones:

Preferred Method:
dpkg-reconfigure tzdata
Alternate Method:
timedatectl list-timezones

Set time zone (example):
timedatectl set-timezone 'America/Los_Angeles'

Use 'date' command to check time.

Add New User
adduser example_user

Add to sudo:
adduser example_user sudo
From here on, all commands will be issues by tim (but w/sudo sometimes)

Skipping 'create authentication key-pair' (used to disallow SSH via password)

Install Apache 2.4
sudo apt install apache2

Install MySQL
sudo apt install mysql-server

Install PHP & Additional Dependencies/support
sudo apt install php7.2 libapache2-mod-php7.2

Optional supports can be added to or some removed, depending on your needs.  You may only need a few like mysql & curl.  I usually install all of these to cover bases:
sudo apt-get install php-pear php-curl php-dev php-gd php-mbstring php-zip php-mysql php-xml php-json php-cgi php-mysql
Configure Apache
KeepAlive On
MaxKeepAliveRequests 50
KeepAliveTimeout 5
sudo nano /etc/apache2/apache2.conf
(linode had the correct settings and didn't need modified)

mpm prefork module:
StartServers 4
MinSpareServers 3
MaxSpareServers 30
MaxRequestWorkers 150
MaxConnectionsPerChild 10000

sudo nano /etc/apache2/mods-available/mpm_prefork.conf

Disable event module & enable prefork:
sudo a2dismod mpm_event
sudo a2enmod mpm_prefork
(found that this was also not necessary as event was already disabled and prefork was already enabled)
Restart apache:
sudo systemctl restart apache2

Setup Virtual Hosts

Make copy of default configuration file, replacing example.com with website:
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf

Sudo nano /etc/apache2/sites-available/example.com.conf

Following lines need to be uncommented, added or edited:

        ServerName example.com
        ServerAlias www.example.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/example.com/public_html

        ErrorLog /var/www/html/example.com/logs/error.log
        CustomLog /var/www/html/example.com/logs/access.log combined
You must create the public_html folder.  Also, something that Linode never mentions, you will need to allow yourself write permissions on the folder:

sudo mkdir -p /var/www/html/thecontrolpanel.live/{public_html,logs}

sudo chown -R $USER:$USER /var/www/html/thecontrolpanel.live/public_html
The command above give the logged in user appropriate permissions.

That was also not ideal. Most of the people, myself included, that write Linux material have no clue when it comes to permissions.
So here's an alternative I'm trying...
sudo chown -R www-data:www-data /var/www/html/eth.blockinetics.io/public_html

...then add your username to www-data:
sudo adduser tim www-data

Link virtual hosts file from sites-available directory to sites-enabled directory:

Enable website
sudo a2ensite example.com

Disable default virtual host
sudo a2dissite 000-default.conf

MySQL Setup
sudo mysql -u root

Create database & user:
CREATE DATABASE webdata;
GRANT ALL ON webdata.* TO 'webuser' IDENTIFIED BY 'password';
(change 'webuser' & 'password' appropriately)

Then exit:
exit;

sudo mysql_secure_installation
Answer yes to:
remove anonymous users
disallow root login remotely
remove test database & access to it
reload privilege tables now

Configure PHP

Edit configuration file:
sudo nano /etc/php/7.2/apache2/php.ini

Following should be set:
error_reporting = E_ALL
max_input_time = 30
error_log = /var/log/php/error.log


Note: for production, error reporting should be:
Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

Create the log directory/file & give access to apache system user:
sudo mkdir /var/log/php
sudo chown www-data /var/log/php

Restart apache:
sudo systemctl restart apache2
Install PhpMyAdmin
sudo apt-get install mcrypt
sudo service apache2 restart
sudo apt-get install phpmyadmin

create symbolic link:
sudo ln -s /usr/share/phpmyadmin
 
NODE & NPM
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -yq --no-install-recommends libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3
 
 

 
 
 




 
 
 
 
 




 


 
 
 
 
 
 


 
  • No comments found

Leave your comments

Post comment as a guest

0
Your comments are subjected to administrator's moderation.
X