The construction and application of Apache server on Linux platform

Source: Internet
Author: User

Background

A chance, in the laboratory download a film "Gardenia Open", in the laboratory to see the film is certainly not good = = so I want to copy to the bedroom computer to look back slowly, the problem is to forget to take a U disk, which can be worried. Suddenly think, you can build an Apache server in the laboratory to upload the film, back to the bedroom to download the line AH. Because IP is definitely in the campus LAN, so it can work, and transmission speed will be ideal.

Build the server

1. Installation and Construction

The first step is to install the Apache server on the lab's computer, my laptop is installed with Windows and Ubuntu dual system, but I choose the system platform for Ubuntu 14.04LTS 64bit.

As for why not choose Windows? Because of the trouble in Windows, also need to have JRE dependency, and Ubuntu belongs to Linux system, direct command line Apt-get Install can be used, in Ubuntu Terminal input command:

Root#apt-get Install Apache2

If the prompt does not have a source available, you can first enter the Apt-get update update source, or the last officer dot click Open Link Download source package decompression compiled installation, here is not introduced, because for most of the Linux system can be directly apt-get fool-type installation.

2. Verify that Apache is installed successfully

After installation, the terminal did not error, Apache has been running in the background, you can use Terminal command PS-E | grep Apache to see if there is an Apache process running.

Of course, you can also more intuitively, enter localhost on the browser address bar, or use native IP instead of localhost, here because Apache uses the default port number 80, so do not enter the port number can also display the Apache installation successful prompt page ("It Works !" or something).

Now that the Apache server environment has been successfully built, the next step is to write the server page (including the download file directory and some basic information, etc.).

3. Designing the Server Page

To enter the Apache server directory, cd/var/www can see there is a index.html file, open the file you can find that this is just the browser on the display of the server page.

Below, you can edit on the index.html, design your own desired server page, make the server page look more cool and achieve more features, you can also create a new file in the same directory new.html, so enter

localhost/new.html to access the page for this new file.

I chose to modify the index.html directly above, so that the access server can save more input new.html. For example, the simple Server page is designed as follows:

<! DOCTYPE html>The pictures and songs are placed directly in the/var/www directory, which is the same directory as index.html, and the movie files are placed in the/var/www/download directory. In this code, I represent the source of the picture and the song as Src= "11,jpg", src= "Xxx.mp3", and the source of the movie file is expressed as src= "download/xxx.flv".

As for the rest of the code, it is the HTML tag and its attributes, and the basic knowledge of HTML can be mastered.

Access server

After setting up the server in the lab, I went back to the bedroom to open the Computer browser input server IP, successfully visited the server page, as follows:

Click the Download button, the browser will pop up the prompt box, let you choose whether to use the player to open or save to the computer, select "Save", immediately start the file transfer, and download speed unexpectedly reached more than 10mb/s (in fact too fast words on the hard disk is not very good), quickly a bit unexpected:

In addition I added an online to listen to the movie episode function, can combine the auditory experience this movie.

Publish this server IP in a friend circle, let other friends who want to see the movie can also download to, but because it is CS architecture, the more people download, download speed will be slower. And the download speed is related to the visitor's own IP, because the server is connected to the campus LAN with Ethernet, so the client with Ethernet access than with the wireless network access is much faster, probably because there are fewer gateways.

If the number of visitors will be too slow or even time-out problems, later also need to join the transmission of shunt/congestion control functions, or can be made to peer-to architecture is more ideal. In addition, the server page is a static HTML page, the function is very single, with node. JS Design Dynamic page is also much better, I tried to build node. JS can also be successfully accessed, this will be done in detail later.

Summarize

This article introduces the Apache server construction and application to this end, and finally briefly summed up: on the Linux platform to build Apache very simple and convenient, design server Pages need to use a bit of HTML basic knowledge, transmission speed in the same LAN is very ideal, can be very good to liberate the U disk, It is a good way to share files with different hosts in the same LAN.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The construction and application of Apache server on Linux platform

Related Article

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.