Giter VIP home page Giter VIP logo

apache2-setup's Introduction

Setting up Digital ocean apache2 webserver on ubuntu

Install fail2ban if password ssh enabled

apt install fail2ban

https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04

Display profiles that apps have registered with ufw

ufw app list

> Available applications:
>   OpenSSH

Add firewall rule via profile

ufw allow 'OpenSSH'

Enable firewall

ufw enable

Show firewall rules

ufw status

https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-20-04

Update local package index and install apache2 package

apt update
apt install apache2

Adjust firewall

ufw app list

> Available applications:
>   Apache
>   Apache Full
>   Apache Secure
>   OpenSSH

ufw allow '<SELECT FROM LIST>'

Common commands

systemctl status apache2 
systemctl stop apache2
systemctl start apache2
systemctl restart apache2 // stop, start
systemctl reload apache2  // reload config changes

Setting up Virtual hosts

Create root dir for each domain /var/www/<domain> Copy and amend /etc/apache2/sites-available/000-default.conf for each domain

<VirtualHost *:80>
    ServerAdmin <your email>
    ServerName <domain>.com
    ServerAlias www.<domain>.com ...other alias'
    DocumentRoot /var/www/<domain>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Test for config errors

apache2ctl configtest

Disable default

a2dissite 000-default.conf

Enable file

a2ensite <domain>.conf

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-20-04

Install certbots

apt install certbot python3-certbot-apache

Ensure ServerName and ServerAlias is correct for each Virtual host

certbot --apache

certbot renew status (runs twice a day to renew cert if expiry within 30 days)

systemctl status certbot.timer

Test renewal process

certbot renew --dry-run

apache2-setup's People

Contributors

spicalous avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.