0% found this document useful (0 votes)
172 views5 pages

Apache and Nginx Setup Guide

This document provides instructions for setting up various server software like Nginx, Apache2, MariaDB, PHP, SSL certificates, and a mail server on a Linux system. It includes commands for installing, configuring, and testing each component as well as enabling remote access to MariaDB and renewing SSL certificates. Overall, the document serves as a guide for deploying a full LAMP stack with a mail server on a Linux server.

Uploaded by

Muhtasim Muiz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
172 views5 pages

Apache and Nginx Setup Guide

This document provides instructions for setting up various server software like Nginx, Apache2, MariaDB, PHP, SSL certificates, and a mail server on a Linux system. It includes commands for installing, configuring, and testing each component as well as enabling remote access to MariaDB and renewing SSL certificates. Overall, the document serves as a guide for deploying a full LAMP stack with a mail server on a Linux server.

Uploaded by

Muhtasim Muiz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

sudo timedatectl set-timezone Asia/Dhaka

sudo /etc/hosts

209.97

NGINX:

sudo apt update

sudo apt install nginx

sudo systemctl status nginx

sudo ufw allow 'Nginx Full'

sudo nginx -t

sudo systemctl restart nginx

APACHE2:
sudo apt-get update

sudo apt-get install apache2

sudo apache2ctl configtest

sudo nano /etc/apache2/apache2.conf servername

sudo apache2ctl configtest result syntex okay

sudo systemctl restart apache2

sudo ufw app list

sudo ufw app info "Apache Full"

sudo ufw allow in "Apache Full"

maria db:

Setup the system apt repo: 

sudo apt-get install software-properties-common

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80


0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el]
http://mirror.jmu.edu/pub/mariadb/repo/10.1/ubuntu xenial main'

Install MariaDB: 

sudo apt update -y

sudo apt install -y mariadb-server

Having MariaDB installed, you can confirm the installation with: 

mysql -V

The output should be similar to: 

mysql Ver 15.1 Distrib 10.1.22-MariaDB, for debian-linux-gnu (x86_64) using readline
5.2

Start the MariaDB service: 

sudo systemctl start mariadb.service

sudo systemctl enable mariadb.service

Secure the installation of MariaDB: 

sudo /usr/bin/mysql_secure_installation

Log into the MySQL shell as ​root​: 

mysql -u root -p

CREATE DATABASE etender;

CREATE USER 'etender'@'%' IDENTIFIED BY '$$,01,Sep,09';

GRANT ALL PRIVILEGES ON *.* TO 'etender'@'%' IDENTIFIED BY '$$,01,Sep,09' WITH GRANT


OPTION;
FLUSH PRIVILEGES;

EXIT;

Remote access

Sudo nano /etc/mysql/my.cnf

#skip-networking

...

#bind-address = <some ip-address>

sudo systemctl restart mariadb.service

sudo systemctl enable mariadb.service

PHP:

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

sudo nano /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
DirectoryIndex ​index.php​ index.html index.cgi index.pl index.xhtml
index.htm
</IfModule>

sudo systemctl restart apache2

sudo systemctl status apache2

sudo nano /var/www/html/info.php

<?php
phpinfo();
?>
sudo rm /var/www/html/info.php

sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-mbstring


php7.0-gd php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt php7.0-zip

sudo apt-get install -y php7.0 php7.0-fpm php7.0-cli php7.0-common php7.0-mbstring php7.0-gd


php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt php7.0-zip

sudo systemctl restart apache2.service

FOR SSL

sudo add-apt-repository ppa:certbot/certbot

sudo apt-get update

sudo apt-get install python-certbot-apache

The certbot Let's Encrypt client is now ready to use.

sudo certbot --apache -d eskabid.com.bd -d ​www.eskabid.com.bd

TO CHECK SSL
https://www.ssllabs.com/ssltest/analyze.html?d=​eskabid.com.bd​&latest

sudo certbot renew --dry-run

FOR MAIL
sudo apt-get update

sudo apt install mailutils

sudo nano /etc/postfix/main.cf

mailbox_size_limit = 0

myhostname= eskabid.com.bd
recipient_delimiter = +

inet_interfaces = loopback-only

mydestination = $myhostname, localhost.$ eskabid.com.bd, $eskabid.com.bd

sudo systemctl restart postfix

echo "This is the body of the email" | mail -s "This is the subject line"
smmuiz@gmail.com

sudo nano /etc/aliases


postmaster: root
root: ​donot-reply@​eskabid.com.bd

sudo newaliases
sudo nano /etc/hostname

You might also like