0% found this document useful (0 votes)
12 views

01-ubuntu-server-apache2

Uploaded by

OUSSAMA ZOGHLAMI
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

01-ubuntu-server-apache2

Uploaded by

OUSSAMA ZOGHLAMI
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1/update Ubuntu server

apt update && apt upgrade -y


apt-get install ubuntu-desktop
----
Source : https://techhut.tv/how-to-apache-webserver-ssl/
1/hostname
# nano /etc/hostname
Ctrl+o Entr Ctrl+x
=> pour la modification du hostname (wa.it.com).
# nano /etc/hosts
=> pour ajouter domain au niveau hosts 127.0.0.1 wa.it.com
-----------------------------------------------------------------------------------
--------
en mode root
# adduser admin
# adduser admin sudo (group sudo)
# su admin (to connect)
-----------------------------------------------------------------------------------
--------
pour dédactiver l'accées root depuis ssh il faut modifier la ligne ci-dessous
# sudo nano /etc/ssh/sshd_config
permitRootLogin yes/NO
# sudo systemctl restart sshd/ssh
# sudo reboot
-----------------------------------------------------------------------------------
--------
*/* Serveur web
1. Install and Configure Apache
# sudo apt install apache2
# sudo apt install apache2 apache2-docs apache2-utils
# sudo systemctl status apache2
# sudo apache2 -v
# sudo systemctl start apache2
# sudo systemctl stop apache2
# sudo systemctl enable apache2
-----------------------------------------------------------------------------------
--------
*/* Config
# sudo a2dissite 000-default.conf (to disable the website default, after we create
our own website
# sudo systemctl reload apache2
---++++
# sudo a2ensite 000-default.conf
# sudo systemctl reload apache2

*/* Firewall Configuration


# sudo ufw app list
=> The applications we will be allowing is Apache Full and OpenSSH
# sudo ufw allow 'Apache Full'
# sudo ufw allow OpenSSH
=>From here, let’s enable our firewall and check its status.
# sudo ufw enable
# sudo ufw status
-----------------------------------------------------------------------------------
----------
-----------------------------------------------------------------------------------
----------
-----------------------------------------------------------------------------------
----------
*/* Creating Website (glpi-server.net)
# cd /var/www/html
# sudo mkdir glpi-server.net
# cd glpi-server.net
# sudo mkdir public_html
# sudo mkdir logs
# sudo mkdir backups
=> After creating our directories, we will return to the location of the site
configurations and create a new one for our website.
# cd /etc/apache2/sites-available
# ls
# sudo nano glpi-server.net.conf

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName glpi-server.net
ServerAlias glpi-server.net
DocumentRoot /var/www/html/glpi-server.net/public_html/
ErrorLog /var/www/html/glpi-server.net/log/error.log
CustomLog /var/www/html/glpi-server.net/log/access.log combined
</VirtualHost>

=> Now, we run a few commands to enable our new configuration.

# sudo a2ensite glpi-server.net.conf


# sudo systemctl reload apache2

Installing SSL Certification


An SSL certificate is a digital certificate that authenticates a website’s identity
and enables an encrypted connection. SSL stands for Secure Sockets Layer, a
security protocol that creates an encrypted link between a web server and a web
browser. In the modern web, it is a basic requirement. To install an SSL
certificate, make sure your domain is properly linked to your new Apache server and
follow the steps below.

sudo apt install certbot python3-certbot-apache


sudo certbot --apache -d example.com
When you run the command above, it will prompt you for more information. Read all
the prompts and fill out any information as needed. If it was successful, you’ll
get a message, and now you can visit your new website with https.

-------------
sudo ap-get install ./nom de packge dans la répératoire actif

You might also like