Welcome to My Website!

Web Server Guides for Linux Beginners

This page covers everything about web server software installation and common configuration setups such as the LAMP (Linux, Apache, MySQL and PHP) and LEMP (Nginx, Apache, MySQL and PHP) environments in Linux server.

LAMP Installation Guides

LEMP Installation Guides

Apache Web Server Hardening and Security

  1. 5 Tips to Boost the Performance of Your Apache Web Server
  2. 13 Apache Web Server Security and Hardening Tips
  3. Install Varnish Cache to Boost Apache Performance on CentOS 7
  4. 25 Useful Apache ‘.htaccess’ Tricks to Secure and Customize Websites
  5. How to Change Apache HTTP Port in Linux
  6. How to Monitor Apache Performance using Netdata on CentOS 7
  7. How to Hide Apache Version Number and Other Sensitive Info
  8. How to Secure Apache with Free Let’s Encrypt SSL Certificate on Ubuntu and Debian
  9. How to Install Let’s Encrypt SSL Certificate to Secure Apache on CentOS 7
  10. How to Create Apache Virtual Hosts with Enable/Disable Options in CentOS 7
  11. How to Setup Standalone Apache Server with Name-Based Virtual Hosting with SSL Certificate
  12. How to Password Protect Web Directories in Apache Using .htaccess File
  13. How to Monitor Apache Web Server Load and Page Statistics
  14. How to Change Apache Server Name to Anything in Server Headers
  15. How to Redirect HTTP to HTTPS on Apache
  16. How to Change Default Apache ‘DocumentRoot’ Directory in Linux
  17. How to Secure Apache with SSL and Let’s Encrypt in FreeBSD

Apache Web Server Tips & Tricks

  1. How to Check Which Apache Modules are Enabled/Loaded in Linux
  2. Apache Virtual Hosting: IP Based and Name Based Virtual Hosts
  3. 3 Ways to Check Apache Server Status and Uptime in Linux
  4. Find Top 10 IP Addresses Accessing Your Apache Web Server
  5. How to Configure, Manage and Monitor “Apache Web Server” Using “Apache GUI” Tool
  6. How to Install Mod_GeoIP for Apache in RHEL and CentOS
  7. How to Sync Two Apache Web Servers/Websites Using Rsync
  8. lnav – Watch and Analyze Apache Logs from a Linux Terminal
  9. How to Limit User File Upload Size in Apache
  10. Redirect a Website URL from One Server to Different Server in Apache
  11. GoAccess – A Real Time Apache Web Server Log Analyzer
  12. 25 Apache Interview Questions for Beginners and Intermediates
Читайте также:  Elementary os linux обзор

Nginx Web Server Hardening and Security

  1. The Ultimate Guide to Secure, Harden and Improve Performance of Nginx Web Server
  2. Learn How to Speed Up Websites Using Nginx and Gzip Module
  3. Install Nginx with Ngx_Pagespeed (Speed Optimization) on Debian and Ubuntu
  4. Install Varnish Cache Improve Nginx Performance on Debian and Ubuntu
  5. Setup HTTPS with Let’s Encrypt SSL Certificate For Nginx on CentOS
  6. Secure Nginx with Free Let’s Encrypt SSL Certificate on Ubuntu
  7. How to Secure Nginx with SSL and Let’s Encrypt in FreeBSD
  8. Setting Up High-Performance ‘HHVM’ and Nginx/Apache with MariaDB on Debian/Ubuntu
  9. How to Change Nginx Port in Linux
  10. How to Hide Nginx Server Version in Linux
  11. How to Monitor Nginx Performance Using Netdata on CentOS 7

Nginx Web Server Tips & Tricks

Hosting Websites with Web Server

Источник

How to Host a Website on NGINX Web Server

NGINX (pronounced as Engine-X) is a free and open-source web server software, load balancer, and reverse proxy optimized for very high performance and stability. NGINX offers low memory usage and high concurrency — which is why it is the preferred web server for powering high-traffic websites.

In this tutorial, you will learn how to install an NGINX webserver to host a simple HTML website running on a Linux platform.

Install NGINX Web Server in Linux

On Ubuntu and Debian-based distributions, run the command below to install NGINX.

On Red Hat Linux and related distributions, you might need to first add the EPEL repository with the command below.

$ sudo yum install epel-release

Next, update the repository with:

Now, you may run the following command to install NGINX on Red Hat and related distributions.

Once installed, you can start and check the status of NGINX as follows.

$ sudo systemctl start nginx $ sudo systemctl status nginx

Check NGINX Status on Ubuntu Check NGINX Status on RHEL

After you have successfully installed NGINX and confirmed that it is running, open a web browser and enter the IP address of your Linux server.

http://IP-Addresss OR http://localhost

You should see the test page for NGINX as shown in the images below.

Check NGINX Page on Ubuntu Check NGINX Page on RHEL

Host a Simple HTML Website on NGINX

On Ubuntu and Debian-related distributions, the default website root is /var/www/html and this is where you should put your website content.

Читайте также:  Самые защищенные linux дистрибутивы

Change into the default website root with:

As for Red Hat, as indicated on the NGINX test page, the default website root is /usr/share/nginx/html and this is where you should put your website content.

Go into the default website root with:

Once you are in the default website root, run the command below to rename any existing index.html file.

$ sudo mv index.html index.html.bk

Note: On Ubuntu, you may get a message saying that the file does not exist. It’s okay to move on to the next step.

Now, run the following command to create your own index.html file.

Copy and paste the sample HTML code below into the text editor.

   

My website is live on NGINX!

Hello World!

Save and close the index.html file.

Finally, refresh your web browser to see your new website.

A Sample Website Hosted on Nginx

Manage NGINX Web Server in Linux

Here are some additional commands for the basic management of your NGINX web server.

To configure NGINX to automatically start when the Linux server is rebooted, run:

$ sudo systemctl enable nginx

To disable automatic starting of NGINX when the Linux server is rebooted, run:

$ sudo systemctl disable nginx

To restart NGINX, run:

$ sudo systemctl restart nginx

To reload NGINX configuration settings without restarting the service, run:

$ sudo systemctl reload nginx

To stop NGINX, run:

$ sudo systemctl stop nginx
Conclusion

In this guide, you have learned how to install NGINX on Ubuntu/Debian as well as Red Hat Linux distributions. We also showed you how to add your own website content.

Источник

How to Host a Website on an Apache Web Server

The Apache HTTP Server (commonly referred to simply as Apache), is a free and open-source web server software brought to you by the Apache Software Foundation. Apache has been around for more than 2 decades and is considered beginner-friendly.

In this tutorial, you will learn how to install an Apache webserver to host a simple HTML website running on a Linux platform.

Install Apache Web Server in Linux

On Ubuntu Linux and other Debian-based distributions such as Linux Mint, Apache can be installed with the following command.

$ sudo apt install apache2 -y

On Red Hat Enterprise Linux and related distributions such as CentOS, Fedora, and Oracle Linux, Apache can be installed with the following command.

On Ubuntu Linux and other Debian-based distributions, you can start and check the status of the Apache webserver by running the commands below.

$ sudo systemctl start apache2 $ sudo systemctl status apache2

Check Apache Status on Ubuntu

On Red Hat Enterprise Linux and related distributions, run the following commands to start and check the status of Apache.

$ sudo systemctl start httpd $ sudo systemctl status httpd

Check Apache Status on RedHat

Once you have confirmed that Apache is active, open a web browser and enter the IP address of your Linux server. You may also enter localhost in place of your server IP.

Читайте также:  Основы операционных систем linux

You should see a test page that confirms that Apache is up and running properly.

http://IP-Addresss OR http://localhost

Check Apache Web Page on Ubuntu Check Apache Web Page on RHEL

Host a Simple HTML Website on Apache

After you have confirmed that Apache is working properly, you are now ready to add your website content. On Apache, the default location where publicly accessible web content is stored in /var/www/html. This is commonly referred to as the website root.

The first page that is loaded when users visit your website is called the index page. Let us create one as follows.

Firstly, change into the website root with the command below.

On Ubuntu Linux, run the command below to rename the default index page file.

$ sudo mv index.html index.html.bk

On Red Hat, there is nothing to rename here as the default index page file is not stored in this location.

Next, create a new index file with:

Copy and paste the sample HTML code below into the open text editor.

    

Linux Shell Tips

This website is hosted on Apache.

Save and close the index.html file.

Now, go back to your web browser and refresh the page. You should see your new website as shown in the image below.

A Sample Website Hosted on Apache

Manage Apache Web Server in Linux

As we wrap up this tutorial, let us highlight some basic commands for managing Apache in addition to the ones that we have already used. As you may have noticed, the Apache web service is referred to as apache2 on Ubuntu while it is called httpd on Red Hat Linux.

To configure Apache to automatically start when the Linux server is rebooted, run:

$ sudo systemctl enable apache2 $ sudo systemctl enable httpd

To disable automatic starting of Apache when the Linux server is rebooted, run:

$ sudo systemctl disable apache2 $ sudo systemctl disable httpd
$ sudo systemctl restart apache2 $ sudo systemctl restart httpd
$ sudo systemctl stop apache2 $ sudo systemctl stop httpd
Conclusion

In this tutorial, we have described how to install Apache on Ubuntu Linux as well as Red Hat Linux. We also showed you how to replace the default Apache web page with your own content.

Источник

Оцените статью
Adblock
detector