{"id":38980,"date":"2018-08-01T11:10:55","date_gmt":"2018-08-01T16:10:55","guid":{"rendered":"https:\/\/webirix.com\/?p=38980"},"modified":"2018-08-01T11:10:55","modified_gmt":"2018-08-01T16:10:55","slug":"instalar-apache-ubuntu","status":"publish","type":"post","link":"https:\/\/webirix.com\/en\/instalar-apache-ubuntu\/","title":{"rendered":"Install apache on ubuntu"},"content":{"rendered":"<p>Apache server is the most widely used web server in the world. It provides many powerful features including dynamically loaded modules, robust media support, and extensive integration with other popular software.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Apache is available within Ubuntu&#039;s default software repositories, so we&#039;ll install it using conventional package management tools.<\/p>\n<ul>\n<li>sudo apt-get update<\/li>\n<\/ul>\n<ul class=\"prefixed\">\n<li class=\"line\">sudo apt-get install apache2<\/li>\n<\/ul>\n<h4 class=\"code-pre command\"><code><\/code> During installation, Apache registers with UFW to provide some application profiles. We can use these profiles to simplify the process of enabling or disabling access to Apache through our firewall. sudo ufw app list You should get a list of the app profiles:<\/h4>\n<pre class=\"code-pre\"><code>Available applications: Apache Apache Full Apache Secure OpenSSH<\/code><\/pre>\n<p>As you can see, there are three profiles available for Apache:<\/p>\n<ul>\n<li><strong>Apache<\/strong> - This profile opens only port 80 (normal unencrypted web traffic)<\/li>\n<li><strong>Full apache<\/strong> - This profile opens both port 80 (normal unencrypted web traffic) and port 443 (encrypted TLS \/ SSL traffic)<\/li>\n<li><strong>Apache Secure<\/strong>- This profile opens only port 443 (encrypted TLS \/ SSL traffic<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>For our purposes, we will allow inbound traffic for the profile <strong>full Apache<\/strong> writing:<\/p>\n<p>sudo ufw allow &#039;Apache Full&#039;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>You can verify the change by typing:<\/p>\n<p>sudo ufw status<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>You should see the allowed HTTP traffic in the displayed output:<\/p>\n<pre class=\"code-pre\"><code>Status: active To Action From - ------ ---- OpenSSH ALLOW Anywhere Apache Full ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Apache Full (v6) ALLOW Anywhere (v6)\r\n\r\n\r\n\r\n<\/code><\/pre>\n<h6 id=\"step-3-check-your-web-server\">Step 3: check your web server<\/h6>\n<h4 class=\"code-pre\"><code><br \/>\nAt the end of the installation process, Ubuntu 16.04 starts Apache. The web server should already be up and running.<br \/>\nWe can check with the init system to make sure the service is running by typing:<\/code><\/h4>\n<p>sudo systemctl status apache2<\/p>\n<p>Try typing this at your server&#039;s command prompt:<\/p>\n<p>hostname -I<\/p>\n<p>You will receive some addresses separated by spaces. You can test each one in your web browser to see if they work.<\/p>\n<p>&nbsp;<\/p>\n<p>An alternative is to type this, which should give you your public IP address as seen from another location on the internet:<\/p>\n<ul class=\"prefixed\">\n<li class=\"line\">sudo apt-get install curl<\/li>\n<li class=\"line\">curl -4 icanhazip.com<\/li>\n<\/ul>\n<p>When you have the IP address or domain of your server, enter it in the address bar of your browser:<\/p>\n<p>&nbsp;<\/p>\n<p>http: \/\/ server_domain_or_IP<\/p>\n<p>You should see the default Apache web page for Ubuntu 16.04, which should look something like this:<\/p>\n<p class=\"growable\"><img decoding=\"async\" src=\"https:\/\/assets.digitalocean.com\/articles\/how-to-install-lamp-ubuntu-16\/small_apache_default.png\" alt=\"P\u00e1gina predeterminada de Apache\" \/><\/p>\n<h2 id=\"step-4-manage-the-apache-process\">Step 4: Manage the Apache process<\/h2>\n<p>To stop your web server, you can type:<\/p>\n<p>sudo systemctl stop apache2<\/p>\n<p>&nbsp;<\/p>\n<p>To start the web server when it is stopped, type:<\/p>\n<p>sudo systemctl start apache2<\/p>\n<p>&nbsp;<\/p>\n<p>To stop and then start the service again, type:<\/p>\n<ul class=\"prefixed\">\n<li class=\"line\">sudo systemctl restart apache2<\/li>\n<\/ul>\n<p>If you simply make configuration changes, Apache can often reload without dropping connections. To do this, you can use this command:<\/p>\n<ul class=\"prefixed\">\n<li class=\"line\">sudo systemctl reload apache2<\/li>\n<\/ul>\n<p>By default, Apache is configured to start automatically when the server starts. If this is not what you want, you can disable this behavior by typing:<\/p>\n<ul class=\"prefixed\">\n<li class=\"line\">sudo systemctl disable apache2<\/li>\n<\/ul>\n<p>To re-enable the service to start at boot, you can type:<\/p>\n<ul class=\"prefixed\">\n<li class=\"line\">sudo systemctl enable apache2<\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>The Apache server is the most widely used web server in the world. It provides many powerful features including dynamically loaded modules, robust media support, and extensive integration with other popular software. Apache is available within Ubuntu&#039;s default software repositories, so we&#039;ll install it using the tools ...<\/p>","protected":false},"author":54,"featured_media":38987,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-38980","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry"],"jetpack_featured_media_url":"https:\/\/webirix.com\/wp-content\/uploads\/2018\/08\/asf_logo.png","_links":{"self":[{"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/posts\/38980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/users\/54"}],"replies":[{"embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/comments?post=38980"}],"version-history":[{"count":4,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/posts\/38980\/revisions"}],"predecessor-version":[{"id":38988,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/posts\/38980\/revisions\/38988"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/media\/38987"}],"wp:attachment":[{"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/media?parent=38980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/categories?post=38980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webirix.com\/en\/wp-json\/wp\/v2\/tags?post=38980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}