Install Apache on FreeBSD

Source: Internet
Author: User
FreeBSD-Apache Basic installation-Linux Enterprise Application-Linux server application information. The following is a detailed description. Because the HTTP protocol is relatively simple, there are a lot of Web server software, but not many of them have excellent performance, reliability, and functions. Apache is the most popular Web server software. It is based on a popular Web server NCSA-httpd a few years ago and adds many new features to increase functions and improve efficiency, therefore, it is very popular.

The Apache Web site is http://www.apache.org, where you can find the latest Apache source files and binaries, documentation and related development plans. The source files of Apache itself and related modules mentioned here can be obtained from this site.

Apache can run on a variety of operating systems-from Unix to Windows, which is easy to install and configure and provides many new features, such as its support for module functions, it is easy to add new server functions by adding new modules. Apache and FreeBSD are combined to provide excellent stability and performance, and are very suitable for building professional websites with heavy load.

It is very easy to install the Apache server on FreeBSD. You can use Packages Collection to install the binary version of A pache server. However, if you need to adjust the modules supported by Apache for special purposes, you need to re-compile Apache. You can use the Ports Collection for compilation and installation.

In the Ports Collection, several versions of Apache servers are provided, some of which belong to Apache 1.2.x and others are Apache 1.3, even in the same Apache version, apache supported by different modules is also provided. You should select Apache 1.3. You can select apache13 as the basic version for the first installation. This version does not provide additional module support. When you officially use Apache later, you need to add SSL support and PHP3 support, so you should select a apach13-modssl or apache13-php3 version. The basic version of apache13 and the apache13-php3 have pre-compiled Binary packages.


Basic installation

You can use Packages Collection or Ports Collection to easily install the Apache server. During installation, the default setting file is copied to the/usr/local/etc/apache directory. In addition to these standard setting files, these setting files also correspond. if a backup with the suffix default is damaged, you can use the backup to restore the default configuration file. The default configuration file directory is/usr/local/www/data, pointing to the apache document installed with the software, the CGI program directory is/usr/local/www/cgi-bin.

In earlier versions, the default configuration file and document path were not directly installed, but only the backup file ended with. default, and the cgi-bin.default, data. default directory were installed. To remind users to modify the default configuration file. Copy the files and directories ending with. def ault to files and directories that do not include the. default suffix.

The default settings do not necessarily guarantee that the Apache server can be started. The default settings are suitable for the vast majority of cases, but cannot guarantee that there are no special circumstances, such as the server does not have the correct configuration name. In general, you can directly start the Apache server without changing the default settings. However, even so, you also need to change the configuration file according to your actual situation, for example, modify the Administrator's email address. If the Apache server cannot be started normally, it does not matter. This only indicates that the default setting is not suitable for the actual situation of the computer. You can adjust the setting parameters to modify the settings.

The default setting file installed in the Ports Collection is not a template file directly attached to the Apache software package, but the configuration changed by the P ort maintainer according to the FreeBSD environment. Therefore, it is suitable for most FreeBSD environments, apache can be started without any changes.

After the installation is complete, you can start the Apache server. Generally, you can use the apachectl program to complete this operation.

#/Usr/local/sbin/apachectl start

If apache is installed in an earlier version of 1.2.x, the management command apachectl may not exist. You can install it in/usr/local/etc/rc. d. the startup script apache. sh to start Apache. Or run httpd, the daemon program of the Apache server.

#/Usr/local/etc/rc. d/apache. sh start

In Apache 1.3 that provides the apachectl command, apache. sh actually calls this command to start and stop the server.

After the server is started, you can use a browser to check whether the server responds to the http request. You can use the Net scpe Navigtor in X Window. However, the more convenient tool is the lynx browser on the Character interface. For management and maintenance, you can also use te lnet to directly send control commands to the Web server. to verify whether the server is running normally, you do not need to request a document, you only need to send the HEAD request.

$ Telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Headers/http/1.0
HTTP/1.0 200 OK
Date:

If the server can respond to A connection request to port 80 like in this example and return some results for the Request command entered by the user, it means that the installation and running of server A pache are normal. If you use a browser to access the server with the default settings, you will see the Apache documentation. This is because the default page is set as an Apache document. Then, the Web administrator can change the/usr/local/www/data directory to the directory of the webpage document to be released, this enables the system to provide Web services externally.

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.