On the Linux platform, the establishment and application of the apache server, linuxapache

Source: Internet
Author: User

On the Linux platform, the establishment and application of the apache server, linuxapache
Background

By chance, I downloaded a movie "gardenia blossom" in the lab. It is definitely not good to watch a movie in the lab = so I want to copy it to my bedroom computer and go back and watch it slowly, the problem is that you forget to bring a USB flash drive. Suddenly, you can build an apache server in the lab to upload the movie to the room and download it back to the bedroom. Because the ip address must be in the campus LAN, it can work and the transmission speed will be ideal.

Build servers

1. Installation and Setup

The first step is to install and build an apache server on a lab computer. My laptop is installed with windows and ubuntu dual systems, but I chose the system platform Ubuntu 14.04LTS 64bit.

Why not choose windows? In windows, JRE dependency is required because it is difficult to build. ubuntu is a linux system and can be installed with apt-get install directly. Enter the following command on the ubuntu terminal:

Root # apt-get install apache2

If you are prompted that no source is available, you can enter apt-get update to update the source, or click the open link on the official website to download the source code package and decompress it for compilation and installation, for most linux systems, you can directly install apt-get.

2. Verify that apache is successfully installed

After the installation, the terminal does not report an error. apache is already running in the background. You can run the terminal command ps-e | grep apache to check whether the apache process is running.

Of course, you can also enter localhost in the address bar of your browser or use the local ip address instead of localhost. Here, apache uses the default port 80, therefore, if you do not enter the port number, the prompt page indicating successful installation of apache is displayed ("It Works! ).

Now that the apache server environment has been successfully set up, the next step is to compile the Server Page (including downloading the file directory and some basic information ).

3. Design the Server Page

First, go to the apache server directory. cd/var/www can see an index.html file. Open this file and you will find that this is the server page displayed on the browser.

In this case, enter

Localhost/new.html can access the page corresponding to the new file.

I chose to directly modify the index.html plugin. In this example, the server can also save the trouble of inputting new.html. For example, the simple server page is designed as follows:

<! DOCTYPE html> <div class = "abc" style = "background: # B9D3EE "align =" center "bgColor =" light blue "> First, put the images and songs directly under the/var/wwwdirectory, that is, the same directory as index.html, and the movie files under the/var/www/download directory. In this way, in the Code, the source of images and songs is represented as src = "11, jpg", src = "xxx.mp3 ", the source of the movie file is src = "download/xxx. flv ".

For other parts of the Code, some html labels and their attributes are used. you can master the basic knowledge of html.

Access Server

After setting up the server in the lab, I went back to the dormitory and opened a Computer Browser and entered the Server ip address. The server page was successfully accessed, as shown below:

Click the Download button, and a prompt box will pop up in the browser asking you to choose whether to use the player to open or save it to your computer. Select "save" to start file transfer now, in addition, the download speed has reached more than 10 Mb/s (in fact, it is not good for the hard disk if it is too fast), which is a little unexpected:

In addition, I added a function to listen to movie episodes online, so that I can feel this movie with my hearing.

Publish this server ip address in the circle of friends so that other school friends who want to watch this movie can download it. However, because of the CS architecture, the more people download the video, the slower the download speed. In addition, the download speed is related to the visitor's own ip address. Because the server is connected to the campus LAN over Ethernet, the client accesses over Ethernet much faster than over the wireless network, it may be because there are fewer gateways.

If the number of users is large, the access may be slow or even time-out. In the future, you need to add functions such as transmission shunting and congestion control, or you can create a p2p architecture. In addition, the server page is an html static page with a single function and changed to node. js Design of dynamic pages will be much better. I tried to build a node. js can also be accessed successfully. This will be detailed later.

Summary

This article introduces how to build and apply apache servers. It is very simple and convenient to build apache on the linux platform. You need some basic html knowledge to design server pages, the transmission speed is ideal in the same LAN and can free up the USB flash disk. It is a good way to share files with different hosts in the same LAN.

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.