You can now begin adjusting the firewall. Restart Apache to implement your changes: sudo systemctl restart apache2 Since we added the global ServerName directive, all you should see is: OutputSyntax OK Next, check for syntax errors by typing: sudo apache2ctl configtest Save and close the file when you are finished.
Note: If you don’t know your server’s IP address, skip down to the section on how to find your server’s public IP address to find it. If you do not have a domain name associated with your server, you can use your server’s public IP address. Inside, at the bottom of the file, add a ServerName directive, pointing to your primary domain name. Open up the main configuration file with your text edit: sudo nano /etc/apache2/nf Set the 'ServerName' directive globally to suppress this message OutputAH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. While harmless, if you do not set ServerName globally, you will receive the following warning when checking your Apache configuration for syntax errors: sudo apache2ctl configtest Next, we will add a single line to the /etc/apache2/nf file to suppress a warning message. Set Global ServerName to Suppress Syntax Warnings Press Y and hit Enter to continue, and the installation will proceed.
Once you’ve entered your password, apt will tell you which packages it plans to install and how much extra disk space they’ll take up.
It will ask you for your regular user’s password to verify your intentions. Since we are using a sudo command, these operations get executed with root privileges.
A package manager allows us to install most software pain-free from a repository maintained by Ubuntu.įor our purposes, we can get started by typing these commands: sudo apt-get update We can install Apache easily using Ubuntu’s package manager, apt. It’s well-documented, and has been in wide use for much of the history of the web, which makes it a great default choice for hosting a website. The Apache web server is among the most popular web servers in the world. Step 1: Install Apache and Allow in Firewall You can learn how to do this by completing steps 1-4 in the initial server setup for Ubuntu 16.04. Prerequisitesīefore you begin with this guide, you should have a separate, non-root user account with sudo privileges set up on your server. Ubuntu will fulfill our first requirement: a Linux operating system. In this guide, we’ll get a LAMP stack installed on an Ubuntu 16.04 Droplet. The site data is stored in a MySQL database, and dynamic content is processed by PHP. This term is actually an acronym which represents the Linux operating system, with the Apache web server. In this way we have configured our Apache web server in Ubuntu 17.04 Server.A “LAMP” stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. Load the changes that have been made to the configuration file sudo systemctl reload apache2ĭisable Apache automatic startup sudo systemctl disable apache2Įnable automatic Apache startup sudo systemctl enable apache2 Restart the service sudo systemctl restart apache2 Start the service sudo systemctl start apache2 Stop the service sudo systemctl stop apache2
With the verification that the web server works in the ideal way we will know some of the commands that will allow us its management, these are: To check Apache we go to a browser and enter the following syntax: We can see the Apache configuration page loaded correctly. If we want to use another method to know the public IP we can execute the following commands in their order: sudo apt-get install curl We can see that his state is Active. The next step is to verify the availability of the Apache web server and for that, we will consult the IP address of the server executing the following line. Once the rules are added and the firewall enabled it will be necessary to verify that the service is running correctly, to check this we will execute the following command: sudo systemctl status apache2 Note: In case the firewall presents the message that is inactive we must execute the following for its enabling.