The introduction of Web server under FreeBSD platform

Source: Internet
Author: User
Tags add format connect mysql openssl version web services access

In a FreeBSD system, a standard FreeBSD system must have at least one network interface to communicate with other computers. It supports token ring and FDDI, as well as wide area network connections such as common telephone dial-up connections, ISDN, ATM, and so on. This article is going to discuss the set-up of Web services based on this system platform, with the FreeBSD version of 4.7.

A Access to the Internet


The first step in configuration is to have FreeBSD connect to the Internet and set up proxy services. This machine uses ADSL to connect to the Internet in two cases, that is, the dynamic IP obtained by dialing or the static IP provided by the ISP. The following describes the dynamic IP configuration process.

The approach is simple, by directly editing the "/etc/ppp/ppp.conf" file and the "/etc/rc.conf" file to achieve a transparent proxy that connects to the Internet and supports NAT.

When you open the Ppp.conf file to implement the configuration, use the following command:

# vi/etc/ppp/ppp.conf

A simple configuration instance (note a space before set):

Default

Set Log Phase Tun command

Set IFADDR 10.0.0.1/0 10.0.0.2/0

ADSL: # Configuration Code

Set Device Pppoe:vr0 # VR0 to the name of the network card you connect to the ADSL modem

Set MRU 1492

Set MTU 1492

Set AuthName Username # username is a dial-up user name

Set Authkey Password # password is a dial-up password

Set dial

Set Login

Add default Hisaddr

Then, when you open the Rc.conf file to implement the configuration, use the following command:

# vi/etc/rc.conf

A simple configuration instance:

#--Sysinstall generated Deltas--# Tue June 15 21:20:28 1997

# Created:tue 15 21:20:28 1997

# Enable Network daemons for user convenience.

# Please make all changes to this file, not to/etc/defaults/rc.conf.

# This file now contains just the overrides from/etc/defaults/rc.conf.

Hostname= "Www.usweb.com" # Your Host domain name

ifconfig_fxp0= "inet 192.168.0.1 netmask 255.255.255.0" #内网网卡ip地址, Fxp0 is the network card name

Inetd_enable= "YES" # Boot load inetd

Kern_securelevel_enable= "NO"

Linux_enable= "YES"

Nfs_reserved_port_only= "NO"

Sendmail_enable= "NO"

Sshd_enable= "YES"

Usbd_enable= "NO"

Gateway_enable= "YES"

Firewall_enable= "YES" #启用防火墙

firewall_script= "/etc/rc.firewall"

Firewall_type= "Open"

firewall_quiet= "YES"

Firewall_logging_enable= "YES"

Ppp_enable= "YES" # power-on AutoDial

Ppp_mode= "Ddial"

Ppp_nat= "YES" Enable transparent proxy

Ppp_profile= "ADSL" # Configuration Code

#--Sysinstall generated Deltas--# Wed June 16 06:52:13 1997

After modifying and restarting the two files, you can dial the Internet and implement a transparent proxy. The client needs to set DNS to the DNS address provided by the service provider, and the gateway is set to the IP address of the internal network card of the proxy server, this example is "192.168.0.1". and remove all check boxes for connection settings in IE's Internet options. If the domain name is not resolved, check that the "/etc/resolv.conf" file is properly configured with the DNS server address.

Two To install and set up a Web server

Installation and setup of the Web server follow these steps:

The first step: Turn off the squid service, delete the IPFW transparent proxy port forwarding statements, the commands are composed of:

# CD/USR/LOCAL/ETC/RC.D

#./squid.sh Stop

# MV Squid.sh Squid.sh.bak

# IPFW del fwd 127.0.0.1,3128 TCP from 192.168.0.0/24 to any 80

Step Two: Install ports. Use it to make it easy for FreeBSD to install a variety of software. (If the/usr/ports directory is already installed), the command format is:

#/stand/sysinstall

Then select "Configure-distributions-ports" in turn, and ports is installed in the "/usr/ports" directory.


Step three: Then install apache1.3.27 + MODSSL (about the Software installation version you can choose according to the actual situation, the same below). After installation, the system will automatically generate the startup script apache.sh, in the/USR/LOCAL/ETC/RC.D directory. You can start or stop Apache by running apache.sh Start|stop. The command format is:

# Cd/usr/ports/www/apache13-modssl

# Make Install #FreeBSD会自动从网络下载并安装

Fourth step: Install mysql3.23. When completed, the startup script "/usr/local/etc/rc.d/mysql-server.sh" is established. The command format is:

# Cd/usr/ports/databases/mysql323-server

# make Install

Fifth step: Install the Apache module MOD_PHP4, the command format is:

# CD/USR/PORTS/WWW/MOD_PHP4 #FreeBSD会自动从网络下载并安装

Next, edit the "configure.php" file in the scripts directory and add support for OpenSSL, which is in the form of:

# VI scripts/configure.php

After opening this file, find this sentence: OpenSSL "OpenSSL support" on and then change it to: OpenSSL "OpenSSL support" Yes modify "configure.php", then edit Apache configuration file

/usr/local/etc/apache/httpd.conf, add the following:

DirectoryIndex index.php index.html # Set the home page name that can be used by default

AddType application/x-httpd-php. php

AddType Application/x-httpd-php-source Phps # These 2 sentences need to be added manually.

Step Sixth: Start testing

Reboot and log in as root, then execute command "top" (thread view command), and if you see the following, all equipment is ready:

PID USERNAME PRI Nice SIZE RES State COMMAND

Root 2 0 440K 296K Select NATD # network Address translation process

132 Root 2 0 3692K 3052K Select httpd # Apache Process

166 MySQL 2 0 27480K 4824K Poll mysqld # MySQL Process

Enter http://192.168.0.1 in the browser address bar, if the Apache Welcome page is displayed to prove that the Web server was installed successfully, and that the Web page files are stored in the/usr/local/www/data directory, just copy their pages to this directory, You will be able to access your home page.

  please contact the site, timely note your name. Contact Email: edu#chinaz.com (change # to @).



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.