You can do it yourself

How to host your own website from home

Step #1. Install Ubuntu 18.04

Step #2. Install Web server

1. Install Tasksel

sudo apt-get install tasksel

2. Install SSH server

sudo tasksel install openssh-server
sudo service ssh start

3. Install LAMP server

sudo tasksel install lamp-server
sudo apt install mysql-server
sudo apt install libapache2-mod-php7.2 php-mysql
sudo apt install php-curl php-json php-cgi php7.2-xml

sudo apt-get -y install php7.2-mysql php7.2-curl php7.2-gd php7.2-intl php-pear php-imagick php7.2-imap php-memcache php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-mbstring php-gettext
sudo apt update && sudo apt upgrade
sudo systemctl restart apache2

4. Now edit apache2 configuration file

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

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 40
MaxRequestWorkers 200
MaxConnectionsPerChild 10000
</IfModule>

sudo a2dismod mpm_event && sudo a2enmod mpm_prefork

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/qgp.crabdance.com.conf

sudo nano /etc/apache2/sites-available/qgp.crabdance.com.conf

<Directory /var/www/html/qgp.crabdance.com/public_html>
Require all granted
</Directory>
<VirtualHost *:80>
ServerName qgp.crabdance.com
ServerAlias www.qgp.crabdance.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/qgp.crabdance.com/public_html
ErrorLog /var/www/html/qgp.crabdance.com/logs/error.log
CustomLog /var/www/html/qgp.crabdance.com/logs/access.log combined
</VirtualHost>

sudo mkdir -p /var/www/html/qgp.crabdance.com/{public_html,logs}
sudo a2ensite qgp.crabdance.com
sudo a2dissite 000-default.conf && sudo systemctl reload apache2

Create new index.php

sudo nano /var/www/html/qgp.crabdance.com/public_html/index.php

<?php echo “Hello Ubuntu 18.04 <hr>”.date(“j M Y h:iA”); ?>

5. Install MYSQL database

sudo mysql -u root

CREATE DATABASE webdata DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON webdata.* TO ‘webuser’ IDENTIFIED BY ‘password’;
quit

sudo mysql_secure_installation

sudo mkdir /var/log/php && sudo chown www-data /var/log/php && sudo systemctl restart apache2

6. Set a Static IP

sudo nano /etc/netplan/01-netcfg.yaml

network:
version: 2
renderer: networkd
ethernets:
enp0s7:
dhcp4: no
dhcp6: no
addresses: [192.168.0.111/24]
gateway4: 192.168.0.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]

sudo netplan apply && sudo netplan –debug apply

7. Install FTP server

sudo apt-get install vsftpd && sudo mv /etc/vsftpd.conf /etc/vsftpd.conf_orig
sudo nano /etc/vsftpd.conf

listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=10100
allow_writeable_chroot=YES

sudo ufw allow from any to any port 20,21,10000:10100 proto tcp
sudo service vsftpd restart

sudo useradd -m Ubuntu1 && sudo passwd Ubuntu1

sudo usermod -d /var/www/html/qgp.crabdance.com/public_html Ubuntu1
sudo chown -R Ubuntu1:Ubuntu1 /var/www/html/qgp.crabdance.com/public_html
sudo chmod -R 775 /var/www/html/qgp.crabdance.com/public_html
sudo service vsftpd restart

8. Install PHPmyAdmin

sudo apt update && sudo apt install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www/html/qgp.crabdance.com/public_html/phpmyadmin
sudo mv /var/www/html/qgp.crabdance.com/public_html/phpmyadmin /var/www/html/qgp.crabdance.com/public_html/pma_hide

9. Allow read, wright files www-data

sudo groupadd Ubuntu1 && sudo useradd -g Ubuntu1 -G www-data,ftp Ubuntu1 && sudo passwd Ubuntu1
sudo usermod -a -G www-data Ubuntu1 && sudo chmod -R g+w /var/www/html/qgp.crabdance.com/public_html && sudo chown -R www-data:www-data /var/www/html/qgp.crabdance.com/public_html/ && sudo systemctl restart apache2

10. Install Postfix Mail server

sudo apt update && sudo apt install -y mailutils
sudo nano /etc/postfix/main.cf

General type of mail configuration?: Internet Site
System mail name: billdesktop.com
Root and postmaster mail recipient: bill
Other destinations to accept mail for: 192.168.0.111/24, localhost.localdamain, localhost
Force synchronous updates on mail queue?: No
Local networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.111/24
Mailbox size limit: 0
Local address extension character: +
Internet protocols to use: all

sudo systemctl restart postfix

If you need to ever return to re-adjust these settings, you can do so by typing: sudo dpkg-reconfigure postfix

Test email:
echo “Test Email message body.” | mail -s “Email test subject” info@luckyclient.com

sudo tail /var/log/mail.log

11. Register Free Domain name

Create free account on https://freedns.afraid.org
Create Domain name and enter your IP address

Router Set up

1. Open a web browser
2. Go to the Address bar and enter the IP Address of your router then press Enter.
3. A new window prompts for a User name and Password.
4. Open NAT Forwarding – Virtual Server
5. Connect port 80 and 21 to your internal IP 192.168.0.111

12. Install WordPress

sudo apt update && sudo apt install php-soap php-intl php-zip
sudo systemctl restart apache2
sudo a2enmod rewrite && sudo apache2ctl configtest
sudo systemctl restart apache2

Download WordPress
Upload WordPress


Leave a Reply

Your email address will not be published. Required fields are marked *