FreeBSD10.2 installation Apache22

Source: Internet
Author: User
Tags fpm openssl library tld ruby on rails

Mkdir-p/usr/local/apache22

./confingure--prefix=/usr/local/apache22

Make

Make install


[Email protected]:/var/tmp/httpd-2.2.31 #/usr/local/apache22/bin/apachectl-k Start
Httpd:could not reliably (reliable) determine (decision) the server ' s fully (full) qualified (qualified) domain name, using 218.205.57.154 for ServerName
[Wed Feb 10 22:36:37 2016] [Warn] (2) No such file or directory:failed to enable the ' Httpready ' Accept Filter
[Wed Feb 10 22:36:37 2016] [Warn] (2) No such file or directory:failed to enable the ' Httpready ' Accept Filter


[Wed Sep 17 22:01:58 2008] [Warn] (2) No such file or directory:failed to enable the ' Httpready ' Accept Filter

How does I fix this error?

650) this.width=650; "src=" Http://figs.cyberciti.biz/3rdparty/apachelogo.gif "alt=" apachelogo.gif "border=" 0 "/>

A. FreeBSD has special driver called Accf_http. It would buffer incoming connections until a certain complete HTTP requests arrive to speed up and optimize performance.

The utility of accf_http is such and that a server would not be a to context switch several times before performing the initial  Parsing of the request. This effectively reduces the amount of required CPUs utilization to handle incoming requests by keeping active processes I n preforking servers such as Apache low and reducing the size of the file descriptor set this needs to being managed by inter Faces such as SELECT (), poll () or kevent () based servers.

Just Open shell prompt and type the following command to load Accf_http under FreeBSD:
# kldload accf_http
Restart Apache:
# /usr/local/etc/rc.d/apache22 restart

update/boot/loader.conf file

Type the following command so, driver get loaded at the time of the booting system:
# echo ‘accf_http_load="YES"‘ >> /boot/loader.conf


vi /usr/local/apache22/conf/httpd.conf

Modify ServerName 192.168.17.135:80



30.7.1. Overview

FreeBSD is used to run many of the world's busiest web sites.        Most Web servers on the Internet use Apache HTTP servers . The Apache package can be found on your FreeBSD installation disk. If Apacheis not installed with the first installation, it can be installed by www/apache13 or Www/apache22 port.

Once Apachehas been successfully installed, it must be configured.

Attention:

This section describes the configuration of the 1.3.X version of the Apache HTTP server because it is the most used version with FreeBSD. Apache 2.X introduces a lot of new technologies, but this is not discussed here. To learn more about Apache 2.X, please see http://httpd.apache.org/ .

30.7.2. Configuration

The main Apache HTTP Server configuration file will be installed on FreeBSD /usr/local/etc/apache/httpd.conf . This is a typical UNIX text configuration file, which is used # as an annotation character. An exhaustive description of all configuration options is beyond the scope of this book, which will only describe those that are most frequently modified.

  • ServerRoot "/usr/local"

  • This specifies the top-level directory for Apache installations. The execution files are placed in the server root directory bin and sbin subdirectories, while the configuration files are located etc/apache .

  • ServerAdmin [email protected]

  • This address is the address that should be sent when a problem occurs on the server, and it will appear on the server-generated page, such as the error page.

  • ServerName www.example.com

  • ServerNameAllows you to configure the host name that is sent back to the client if your server is accessed by the user under a different name (for example, using www the actual name of the host itself).

  • DocumentRoot "/usr/local/www/data" 或者是 /usr/local/apache22/htdocs

  • DocumentRoot: This directory is the directory where your documents are located. By default, all requests are fetched from this location, but other locations can also be specified by symbolic joins and aliases.

It is always a good practice to back up the Apache configuration files before modifying the configuration. Once you are satisfied with your initial configuration, you are ready to start running Apache .

30.7.3. RunningApache

Unlike many other network services, Apache does not rely on the inetd Super server to run. It is typically configured as a standalone server to provide better performance when a client's Web browser is connected to an HTTP request.        It provides a shell script that makes it as simple as possible to start, stop, and restart the server. To start Apachefor the first time, simply execute:

#/usr/local/sbin/apachectl Start

You can use the following command at any time to stop the service:

#/usr/local/sbin/apachectl Stop

When the configuration file has been modified for some reason, the server needs to be restarted:

#/usr/local/sbin/apachectl Restart

To restart the Apache server without interrupting the current connection, you should run:

#/usr/local/sbin/apachectl Graceful

More information can be found in the apachectl(8) online manual.

To start Apacheat system startup, you should /etc/rc.conf include:

Apache_enable= "YES"

or for Apache 2.2:

Apache22_enable= "YES"

If you want to start the Apache program at boot time httpd and specify some other options, you can add the following line to rc.conf :

Apache_flags= ""

Now that the Web server is running, you can open it using a Web browser http://localhost/ . The Web page that is displayed by default is /usr/local/www/data/index.html .

30.7.4. Virtual Host

Apache supports two different types of virtual hosts. The first method is a name-based virtual host. The name-based virtual host uses the http/1.1 header from the client to identify the host name. This allows a different domain to share the same IP address.

To configure Apache to use a name-based virtual host, you need to add something like the following to your httpd.conf :

Namevirtualhost *

If the name of your Web server is www.domain.tld , and you want to create a www.someotherdomain.tld virtual domain, you should httpd.conf include:

<virtualhost *>servername Www.domain.tldDocumentRoot/www/domain.tld</VirtualHost><VirtualHost * >servername www.someotherdomain.tlddocumentroot/www/someotherdomain.tld</virtualhost>

You need to change the address and document path above to the ones you are using.

To learn more about virtual hosting, please refer to the official Apache documentation, which can be found in the documentation http://httpd.apache.org/docs/vhosts/ .

30.7.5. Apache Module

There are many different Apache modules that can provide many additional features on a basic server basis. FreeBSD's Ports Collection provides a convenient way to install Apache and common add-on modules.

30.7.5.1. mod_ssl

mod_ssl This module uses the OpenSSL Library to provide strong encryption capabilities over Secure Sockets Layer (SSL V2/v3) and Transport Layer Security (TLS v1) protocols. This module provides all the tools you need to request a signed certificate from a trusted certificate authority, which allows you to run a secure Web server on FreeBSD.

If you have not installed Apache, you can also install a copy of the mod_ssl version of Apache 1.3.X, which is done by Www/apache13-modssl port. 。 SSL support has been provided as part of the Apache 2.X and you can install the latter by Www/apache22 port.

30.7.5.2. Language binding

Apache has corresponding modules for some of the major scripting languages.  These modules make it possible to write Apache modules entirely using a scripting language. They are also usually embedded into the server as a resident memory interpreter to avoid the overhead of starting an external interpreter for the dynamic Web site that will be described in the next section for the time and resources.

30.7.6. Dynamic Web site

Over the past 10 years, more and more companies have turned to the internet to increase their profitability and exposure rates. This also enhances the need for interactive Web content. Some companies, such as Microsoft , have launched solutions based on their proprietary products, and the open source community has responded positively. The more fashionable options include Django,ruby on Rails, mod_perl, and mod_php.

30.7.6.1. Django

Django is a BSD-licensed framework that allows developers to quickly write high-quality Web applications. It provides an object-relational mapping component, a data type that can be used as an object in Python, and a rich set of dynamic database access APIs that enable developers to avoid writing SQL statements. It also provides an extensible template system that separates the logical part of the application from the presentation layer of the HTML.

Django relies on mod_python, Apache, and an optional SQL database engine. After setting some of the appropriate flags, the FreeBSD Port system will help you install the necessary dependent libraries.

Example 30.3. Installation of Django,apache2, Mod_python3, and PostgreSQL

# Cd/usr/ports/www/py-django; Make all install Clean-dwith_mod_python3-dwith_postgresql


After installing Django and the dependent software, you need to create a directory of the Django project and then configure Apache to invoke the embedded Python interpreter when there are certain URLs for the application on your site.

Example 30.4. Django/mod_python about the Apache part of the configuration

You need to add the following lines to the Apache configuration file to httpd.conf pass the request for some URLs to your Web application:

<location "/" > SetHandler python-program PythonPath "['/dir/to/your/django/packages/'] + sys.path" Pythonha Ndler Django.core.handlers.modpython SetEnv django_settings_module mysite.settings pythonautoreload on Pythondebu G on</location>


30.7.6.2. Ruby on Rails

Ruby on Rails is another open-source web framework that provides a comprehensive development framework to help web developers work more productively and quickly write powerful applications. It is very easy to install from the posts system.

# cd/usr/ports/www/rubygem-rails; Make all Install
30.7.6.3. Mod_perl

apache /perl Integration Plan, with the power of Perl   programming language, apache The  http server is tightly bound together.   Through mod_perl module,   can use Perl to compose apache Module.   In addition, the persistence interpreter embedded in the server eliminates the performance penalty caused by the startup of the external interpreter for Perl   scripts.

mod_perl is available in several ways.             to use mod_perl ,         &NBSP ;   should note mod_perl 1.0             only with apache 1.3 and            mod_perl 2.0 Can only be used with            apache 2.X.            mod_perl 1.0 is available through         &N Bsp  www/mod_perl installation,             and statically linked versions are available through           &NBS P;www/apache13-modperl             to install.            mod_perl 2.0 is available through         & nbsp &NBSP;WWW/MOD_PERL2 installation.

30.7.6.4. mod_php

Written by Tom Rhodes.

PHP, also known as "php:hypertext preprocessor", is a common scripting language especially suited to WEB development. It can be easily embedded in HTML, and its syntax is close to C, Java, and Perl, with the aim of letting Web developers quickly compose dynamically generated pages.

To obtain PHP5 support for the Apache Web server, you can start with the installation of LANG/PHP5 port.

When you first install LANG/PHP5 port, the system automatically displays a list of available OPTIONS (configuration options). If you do not see the menu, for example, because the LANG/PHP5 port has been installed in the past and so on, you can display the configuration menu again in the directory of port by using the following command:

# make Config

In the Configure Options dialog box, select APACHE this option to co-compile the dynamically loaded mod_php5 module for use with the Apache Web server.

Attention:

Many sites are still using PHP4 for a variety of reasons (for example, because of compatibility considerations for deployed Web apps).    If you need MOD_PHP4 instead of mod_php5, use LANG/PHP4 port. LANG/PHP4 Port also supports the configuration and compile-time options provided by many LANG/PHP5 ports.

We have successfully installed and configured the modules needed to support dynamic PHP applications in the first place. Please check and confirm that you have added the following configuration /usr/local/etc/apache/httpd.conf :

LoadModule Php5_module libexec/apache/libphp5.so
Addmodule mod_php5.c <ifmodule mod_php5.c> directoryindex index.php index.html </IfModule> <    ; Ifmodule mod_php5.c> addtype application/x-httpd-php. php addtype application/x-httpd-php-source. Phps </IfModule>

After the work is done, you will need to use the apachectl command to complete the graceful restart to load the PHP module:

# Apachectl Graceful

In the future when you upgrade PHP, make config This step is no longer required, and your selection OPTIONS will be automatically saved by the FreeBSD Ports framework.

PHP support in FreeBSD is highly modular, so the basic installation features are very limited. Support for additional features is simple and can be done by Lang/php5-extensions Port only. This port provides a menu-driven interface to help complete the installation of PHP extensions. Alternatively, the extension can be installed separately via the corresponding port.

For example, to add support for MySQL database servers to PHP5, simply install them databases/php5-mysql .

After you install the extension, you must restart the Apache server to adapt it to the new configuration changes:

# Apachectl Graceful


PHP Installation

[Email protected]:/usr/ports/lang/php5 # make Install
===> Installing for php5-5.4.43
===> php5-5.4.43 depends on shared Library:libpcre.so-found (/usr/local/lib/libpcre.so)
===> php5-5.4.43 depends on shared Library:libxml2.so-found (/usr/local/lib/libxml2.so)
===> Checking if php5 already installed
===> Registering installation for php5-5.4.43
Installing php5-5.4.43 ...
===> SECURITY Report:
This port have installed the following files which may act as network
Servers and may therefore pose a remote security risk to the system.
/usr/local/bin/php
/usr/local/bin/php-cgi
/usr/local/sbin/php-fpm

This port have installed the following startup scripts which may cause
These network services to being started at boot time.
/usr/local/etc/rc.d/php-fpm

If There is vulnerabilities in these programs there could be a security
Risk to the system. FreeBSD makes no guarantee about the security of
Ports included in the ports Collection. Please type ' make deinstall '
To deinstall the port if this is a concern.

For more information, and contact details about the security
Status of this software, see the following webpage:
http://www.php.net/
[Email PROTECTED]:/USR/PORTS/LANG/PHP5 #

FreeBSD10.2 installation Apache22

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.