The Apache Server installation tutorial

Source: Internet
Author: User
Tags file system domain domain name root directory
apache| Server | Why did you choose Apache? First of all, Apache is free, you don't have to pay for it; second, Apache is open source, you may not feel the benefits, but I can tell you that an open-source software is often able to wait for more extensive support, it can be said that programmers all over the world are serving you. Moreover, it is more flexible, allowing you to choose the module that contains the specific function according to your own needs. To provide you with a message, more than 60% of the world's HTTP servers are now using Apache. So, do you want to join them?

Body

You can download Apache installation files from Apache's web http://httpd.apache.org/download.cgi , or get them on other mirror sites. The latest version is now 2.0.49.

Apache installation is very simple, choose to accept the license agreement to enter the server information configuration interface, the following figure. The first column of domain name "network domain", where you fill in the domain name of your server, if you have applied to the domain name fill in your application domain name, (note here to fill in the domain name, but you apply to the full domain name of the second half, excluding "www". If you are applying for a level two domain name, it is the first "." After that, if not yet, put the IP on the machine to fill in the line. The next line is the server name and fills in the full domain name or IP address. The next column is the admin email address. These three items are required to be completed in the installation, but you can change them at any time after the installation is complete, so you don't have to worry about the wrong fill. The last option is OK.

Click "Next" to go to the next step. Select "Typical" Typical installation, next choose the installation directory, the default installation directory is the system disk program Files/apache Group directory. Tap "Next" and click "Install" to install.

After the installation is complete, you can see five options in the Apache HTTP Server 2.0.49 menu in the Start menu, and now click Start in the "Control Apache Server" directory to start the server. You can see the Apache feather icon appearing in the system status bar with a green arrow indicating that the server started successfully.

Now take a look at our results. Open the browser, enter localhost or 127.0.0.1 (both point to the native address), enter, if installed correctly you can see the Apache test page. Simple, from now on, your computer is also an HTTP server!

Perhaps you will ask, this is not my site Ah, where is my site? Take a few steps, and you'll be able to show your own elaborate website to the world.



First click "Edit the Apache httpd.conf Configuration file" in the Apache directory in the Start menu to open the Apache configuration file (Configure Apache). See the file is not a little scary ah, more than 900 lines of all English documents. But don't be nervous, we are only concerned about some of these lines.

First, we want to let the server display our own content. Find the location of the section 1:global environment, which is the global setting for Apache. Note that most of the files start with #, and the program skips them, so there's no need to study them. Okay, find the first line from the beginning without #, "ServerRoot ...", and then part of your server's root directory, change it to the directory you want, it is recommended that you use an absolute address, so as to avoid some unnecessary problems. One point to note is that the address here is to use a slash '/' instead of the Windows file system's custom backslash ' \ ', without the slash at the end of the address.

OK, this part is the case, the rest is not modified. Go down and find "section 2: ' Main ' Server Configuration", and if you find it too cumbersome, the Find feature in Notepad may help. (in Notepad window, press ctrl+f, will pop up the lookup dialog box, copy the contents of the above, click "Find Next", Notepad will find the line where it is) or only see the line that is not #, the following "ServerAdmin", "ServerName" Some information about the server can be ignored for the time being. Go down and find the "DocumentRoot" line, which is the address of your server's document, and all access to your server will begin at this address, replacing this address with the folder address of your site, with the same attention to the slash '/'.

Here is the and enclosed content that sets the permissions on your server's root directory, where the first angle bracket '/' represents the server's root directory without modification. In the down or an angle bracket, this is the permission setting for the document folder you just set up. Change the path after directory to the path of the document folder you just set, OK, save, click "Restart" under the "Control Apache Server" directory of the Apache folder in the Start menu. Then open the browser, input localhost, enter, is there any change? No change? Try refreshing, do you have it?

So far, your HTTP server can be built up.
However, if you do not have the page you want to display, do not worry, we go back to the document just edited, to find the last change in the location, that is, looking down, there is a line of options, should be "options Indexes followsymlinks", Add a minus sign to the front of the indexes, which prevents the display of the table of contents. It should now be "options-indexes followsymlinks". Next several lines, there is a directoryindex, followed by the server default home page name, the server will sequentially in the directory to find these files, and will be the first to find the display. You can write the name of the default page of your site behind this. (usually add a index.htm) to save, restart. Is there anything else you're not satisfied with?

Wait, something is wrong, how Chinese is garbled? This is the reason Apache set the default language to the Western European language, or open the file that you just edited, find the "Adddefaultcharset" line, and (it is highly recommended to use Notepad's Find tool) to change the content behind it to GB2312. Save and restart the server. Perhaps your browser at this time to see the garbled, it is because the browser remembers this page settings, empty the browser's history and cache, all done!

Well, your present task is to apply for a domain name, it points to your host IP, remember the above mentioned "ServerName", changed to your application of the domain name on it.

Now, as long as you're on the computer and connected to the net, you're the administrator of the Internet's last HTTP server.



  

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.