DigitalOcean home. Community Control Panel. Hacktoberfest Contribute to Open Source. By Kathleen Juell Published on December 12, Introduction The Apache web server is an open-source web server popular for its flexibility, power, and widespread support. How To Use This Guide: Each section can be used independently of others, so feel free to skip to sections that are relevant to your needs.
Each command is self-contained, allowing you to substitute your own values for those in red. Each section has linked resources, which you can consult for more information about covered topics. Installing the Apache Service To install the Apache service, update your package indexes, then install: sudo apt-get update sudo apt-get install apache2 For more details on the installation process, follow our tutorial on How To Install the Apache Web Server on Ubuntu Enabling and Disabling the Apache Unit Our Apache service is configured to start automatically at boot.
If we wanted to modify this behavior, however, we could type the following: sudo systemctl disable apache2. Type the following command: sudo systemctl reload apache2 To learn more about the systemd init system and the systemctl command, check out this introduction to systemd essentials. Checking the Server Status To check the status of your Apache server, type: sudo systemctl status apache2 The output from this command will tell you whether or not Apache is running, and will show you the last few lines in the log files.
If you are upgrading, the installation will not overwrite your configuration files or documents. Then stop the server again by running:. The first step in upgrading is to read the release announcement and the file CHANGES in the source distribution to find any changes that may affect your site. When changing between major releases for example, from 2. All modules will also need to be upgraded to accommodate changes in the module API.
Upgrading from one minor version to the next for example, from 2. The make install process will not overwrite any of your existing documents, log files, or configuration files. In addition, the developers make every effort to avoid incompatible changes in the configure options, run-time configuration, or the module API between minor versions. In most cases you should be able to use an identical configure command line, an identical configuration file, and all of your modules should continue to work.
To upgrade across minor versions, start by finding the file config. This will contain the exact configure command line that you used to configure the source tree. Then to upgrade from one version to the next, you need only copy the config. You can pass additional arguments to config. A large number of third parties provide their own packaged distributions of the Apache HTTP Server for installation on particular platforms. Our software license not only permits, but encourages, this kind of redistribution.
However, it does result in a situation where the configuration layout and defaults on your installation of the server may differ from what is stated in the documentation. While unfortunate, this situation is not likely to change any time soon. A description of these third-party distributions is maintained in the HTTP Server wiki, and should reflect the current state of these third-party distributions.
However, you will need to familiarize yourself with your particular platform's package management and installation procedures. Open a new command prompt as administrator , and enter the following:.
Create a file named index. If all goes well, your test page should appear. In general, most problems will be caused by an incorrect setting in the httpd.
Refer to the Apache documentation if you require further information. Apache needs a virtual hosts file to serve the contents of your server. The default configuration file for this purpose is already created, but we will create a new one for our custom configurations.
The output suggests activating the new configuration, but we can do everything together after running the following command which will deactivate the original configuration file:. The Apache server is now configured to provide your domain name. This can be verified by entering your server name into one of the web browsers on your system as follows:. The index page should appear like this to indicate that Apache is now ready to serve your server block!
After setting up the web server, you may need to perform some basic administration on Apache. Here are the commands you can enter into your Terminal application for these operations.
Through this article, you learned how to install and configure the Apache web server on your Ubuntu system. This includes making some changes to your UFW firewall and then configuring your web server for your IP address.
We also recommend that you set up a virtual host through Apache; This will give you a foundation on how you can use Apache to host your files on the internet.
The basic Apache administration commands will also help you as a web administrator to optimally manage your web server. This website uses cookies so that we can provide you with the best user experience possible.
0コメント